casein 4.0.0 → 5.0.0.0
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.
- checksums.yaml +4 -4
- data/LICENSE +246 -0
- data/PUBLIC_VERSION.yml +2 -2
- data/README.rdoc +73 -49
- data/Rakefile +7 -5
- data/app/assets/fonts/casein/glyphiconshalflings-regular.eot +0 -0
- data/app/assets/fonts/casein/glyphiconshalflings-regular.otf +0 -0
- data/app/assets/fonts/casein/glyphiconshalflings-regular.svg +175 -0
- data/app/assets/fonts/casein/glyphiconshalflings-regular.ttf +0 -0
- data/app/assets/fonts/casein/glyphiconshalflings-regular.woff +0 -0
- data/app/assets/images/casein/casein.png +0 -0
- data/app/assets/javascripts/casein/bootstrap.js +1966 -0
- data/app/assets/javascripts/casein/casein.js +34 -19
- data/app/assets/javascripts/casein/html5shiv.js +8 -0
- data/app/assets/stylesheets/casein/bootstrap-glyphicons.css.scss +2 -0
- data/app/assets/stylesheets/casein/bootstrap.css +4692 -0
- data/app/assets/stylesheets/casein/casein-bootstrap-overrides.css.scss +76 -0
- data/app/assets/stylesheets/casein/casein.css.scss +258 -3
- data/app/assets/stylesheets/casein/login.css.scss +48 -109
- data/app/controllers/casein/{user_sessions_controller.rb → admin_user_sessions_controller.rb} +6 -10
- data/app/controllers/casein/admin_users_controller.rb +124 -0
- data/app/controllers/casein/casein_controller.rb +11 -9
- data/app/controllers/casein/password_resets_controller.rb +8 -10
- data/app/helpers/casein/casein_helper.rb +94 -31
- data/app/mailers/casein/casein_notification.rb +13 -13
- data/app/models/casein/{user.rb → admin_user.rb} +2 -2
- data/app/models/casein/{user_session.rb → admin_user_session.rb} +1 -1
- data/app/views/casein/admin_user_sessions/new.html.erb +56 -0
- data/app/views/casein/admin_users/index.html.erb +39 -0
- data/app/views/casein/admin_users/new.html.erb +57 -0
- data/app/views/casein/admin_users/show.html.erb +104 -0
- data/app/views/casein/casein/blank.html.erb +12 -1
- data/app/views/casein/casein_notification/generate_new_password.erb +1 -1
- data/app/views/casein/casein_notification/new_user_information.erb +1 -1
- data/app/views/casein/casein_notification/password_reset_instructions.erb +1 -1
- data/app/views/casein/password_resets/edit.html.erb +21 -33
- data/app/views/layouts/casein_auth.html.erb +34 -22
- data/app/views/layouts/casein_main.html.erb +111 -64
- data/config/initializers/will_paginate.rb +40 -0
- data/config/routes.rb +2 -2
- data/lib/casein.rb +9 -3
- data/lib/casein/engine.rb +5 -1
- data/lib/generators/casein/install/install_generator.rb +3 -3
- data/lib/generators/casein/install/templates/app/helpers/casein/config_helper.rb +10 -11
- data/lib/generators/casein/install/templates/app/views/casein/layouts/{_left_navigation.html.erb → _tab_navigation.html.erb} +0 -0
- data/lib/generators/casein/install/templates/app/views/casein/layouts/_top_navigation.html.erb +4 -0
- data/lib/generators/casein/install/templates/db/migrate/{casein_create_users.rb → casein_create_admin_users.rb} +3 -3
- data/lib/generators/casein/scaffold/scaffold_generator.rb +20 -8
- data/lib/generators/casein/scaffold/templates/controller.rb +6 -6
- data/lib/generators/casein/scaffold/templates/views/_form.html.erb +11 -8
- data/lib/generators/casein/scaffold/templates/views/_table.html.erb +12 -10
- data/lib/generators/casein/scaffold/templates/views/index.html.erb +7 -3
- data/lib/generators/casein/scaffold/templates/views/new.html.erb +3 -3
- data/lib/generators/casein/scaffold/templates/views/show.html.erb +5 -5
- data/lib/railties/tasks.rake +15 -13
- metadata +67 -46
- data/MIT-LICENSE +0 -21
- data/app/assets/images/casein/header.png +0 -0
- data/app/assets/images/casein/icons/add.png +0 -0
- data/app/assets/images/casein/icons/delete.png +0 -0
- data/app/assets/images/casein/icons/table.png +0 -0
- data/app/assets/images/casein/login/alertBg.png +0 -0
- data/app/assets/images/casein/login/background.png +0 -0
- data/app/assets/images/casein/login/bottom.png +0 -0
- data/app/assets/images/casein/login/loginBoxBg.png +0 -0
- data/app/assets/images/casein/login/loginBoxBottom.png +0 -0
- data/app/assets/images/casein/login/loginBoxTop.png +0 -0
- data/app/assets/images/casein/login/loginSubmit.png +0 -0
- data/app/assets/images/casein/login/recoverSubmit.png +0 -0
- data/app/assets/images/casein/login/top.png +0 -0
- data/app/assets/images/casein/nav.png +0 -0
- data/app/assets/images/casein/rightNav.png +0 -0
- data/app/assets/images/casein/rightNavButton.png +0 -0
- data/app/assets/images/casein/visitSiteNav.png +0 -0
- data/app/assets/javascripts/casein/login.js +0 -27
- data/app/assets/stylesheets/casein/elements.css.scss +0 -307
- data/app/assets/stylesheets/casein/screen.css.scss +0 -224
- data/app/controllers/casein/users_controller.rb +0 -108
- data/app/views/casein/user_sessions/new.html.erb +0 -66
- data/app/views/casein/users/index.html.erb +0 -35
- data/app/views/casein/users/new.html.erb +0 -46
- data/app/views/casein/users/show.html.erb +0 -94
- data/lib/generators/casein/install/templates/app/views/casein/layouts/_right_navigation.html.erb +0 -1
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
module Casein
|
|
2
|
-
class UsersController < Casein::CaseinController
|
|
3
|
-
|
|
4
|
-
unloadable
|
|
5
|
-
|
|
6
|
-
before_filter :needs_admin, :except => [:show, :destroy, :update, :update_password]
|
|
7
|
-
before_filter :needs_admin_or_current_user, :only => [:show, :destroy, :update, :update_password]
|
|
8
|
-
|
|
9
|
-
def index
|
|
10
|
-
@casein_page_title = "Users"
|
|
11
|
-
@users = Casein::User.paginate :order => "login", :page => params[:page]
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def new
|
|
15
|
-
@casein_page_title = "Add a new user"
|
|
16
|
-
@casein_user = Casein::User.new
|
|
17
|
-
@casein_user.time_zone = Rails.configuration.time_zone
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def create
|
|
21
|
-
@casein_user = Casein::User.new casein_user_params
|
|
22
|
-
|
|
23
|
-
if @casein_user.save
|
|
24
|
-
flash[:notice] = "An email has been sent to " + @casein_user.name + " with the new account details"
|
|
25
|
-
redirect_to casein_users_path
|
|
26
|
-
else
|
|
27
|
-
flash.now[:warning] = "There were problems when trying to create a new user"
|
|
28
|
-
render :action => :new
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def show
|
|
33
|
-
@casein_user = Casein::User.find params[:id]
|
|
34
|
-
@casein_page_title = @casein_user.name + " | View User"
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def update
|
|
38
|
-
@casein_user = Casein::User.find params[:id]
|
|
39
|
-
@casein_page_title = @casein_user.name + " | Update User"
|
|
40
|
-
|
|
41
|
-
if @casein_user.update_attributes casein_user_params
|
|
42
|
-
flash[:notice] = @casein_user.name + " has been updated"
|
|
43
|
-
else
|
|
44
|
-
flash.now[:warning] = "There were problems when trying to update this user"
|
|
45
|
-
render :action => :show
|
|
46
|
-
return
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
if @session_user.is_admin?
|
|
50
|
-
redirect_to casein_users_path
|
|
51
|
-
else
|
|
52
|
-
redirect_to :controller => :casein, :action => :index
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def update_password
|
|
57
|
-
@casein_user = Casein::User.find params[:id]
|
|
58
|
-
@casein_page_title = @casein_user.name + " | Update Password"
|
|
59
|
-
|
|
60
|
-
if @casein_user.valid_password? params[:form_current_password]
|
|
61
|
-
if @casein_user.update_attributes casein_user_params
|
|
62
|
-
flash.now[:notice] = "Your password has been changed"
|
|
63
|
-
else
|
|
64
|
-
flash.now[:warning] = "There were problems when trying to change the password"
|
|
65
|
-
end
|
|
66
|
-
else
|
|
67
|
-
flash.now[:warning] = "The current password is incorrect"
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
render :action => :show
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def reset_password
|
|
74
|
-
@casein_user = Casein::User.find params[:id]
|
|
75
|
-
@casein_page_title = @casein_user.name + " | Reset Password"
|
|
76
|
-
|
|
77
|
-
@casein_user.notify_of_new_password = true unless @casein_user.id == @session_user.id
|
|
78
|
-
|
|
79
|
-
if @casein_user.update_attributes casein_user_params
|
|
80
|
-
if @casein_user.id == @session_user.id
|
|
81
|
-
flash.now[:notice] = "Your password has been reset"
|
|
82
|
-
else
|
|
83
|
-
flash.now[:notice] = "Password has been reset and " + @casein_user.name + " has been notified by email"
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
else
|
|
87
|
-
flash.now[:warning] = "There were problems when trying to reset this user's password"
|
|
88
|
-
end
|
|
89
|
-
render :action => :show
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def destroy
|
|
93
|
-
user = Casein::User.find params[:id]
|
|
94
|
-
if user.is_admin? == false || Casein::User.has_more_than_one_admin
|
|
95
|
-
user.destroy
|
|
96
|
-
flash[:notice] = user.name + " has been deleted"
|
|
97
|
-
end
|
|
98
|
-
redirect_to casein_users_path
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
private
|
|
102
|
-
|
|
103
|
-
def casein_user_params
|
|
104
|
-
params.require(:casein_user).permit(:login, :name, :email, :time_zone, :access_level, :password, :password_confirmation)
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
end
|
|
108
|
-
end
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
<%= form_for @user_session, :url => casein_user_session_path do |f| %>
|
|
2
|
-
|
|
3
|
-
<% if @user_session.errors.any? %>
|
|
4
|
-
<div class="error">
|
|
5
|
-
<p>
|
|
6
|
-
<% @user_session.errors.keys.each do |key| %>
|
|
7
|
-
<%= (key.to_s.humanize + " ") unless key == :base %>
|
|
8
|
-
<%= @user_session.errors[key].first %>
|
|
9
|
-
<% end %>
|
|
10
|
-
</p>
|
|
11
|
-
</div>
|
|
12
|
-
<% end %>
|
|
13
|
-
|
|
14
|
-
<% if flash[:warning] %>
|
|
15
|
-
<div class="error">
|
|
16
|
-
<p><%= flash[:warning] %></p>
|
|
17
|
-
</div>
|
|
18
|
-
<% end %>
|
|
19
|
-
|
|
20
|
-
<% if flash[:notice] %>
|
|
21
|
-
<div class="notice">
|
|
22
|
-
<p><%= flash[:notice] %></p>
|
|
23
|
-
</div>
|
|
24
|
-
<% end %>
|
|
25
|
-
|
|
26
|
-
<div class="text" style="margin-bottom:10px;">
|
|
27
|
-
<p>
|
|
28
|
-
<%= f.label :login, "Login:" %>
|
|
29
|
-
<%= f.text_field :login, :class => "caseinTextField" %>
|
|
30
|
-
</p>
|
|
31
|
-
</div>
|
|
32
|
-
|
|
33
|
-
<div class="text">
|
|
34
|
-
<p>
|
|
35
|
-
<%= f.label :password, "Password:" %>
|
|
36
|
-
<%= f.password_field :password, :class => "caseinTextField" %>
|
|
37
|
-
</p>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<div class="submit_remember">
|
|
41
|
-
<p>
|
|
42
|
-
<%= f.check_box :remember_me %> Remember me
|
|
43
|
-
<br /><br />
|
|
44
|
-
<%= f.submit "Log in", :class => "caseinSubmit" %>
|
|
45
|
-
<input type="button" value="Forgotten password?" class="caseinSubmitBlue" onclick="toggleDiv('recover');" />
|
|
46
|
-
</p>
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
<% end %>
|
|
50
|
-
|
|
51
|
-
<%= form_tag casein_password_reset_url do %>
|
|
52
|
-
<div id="recover">
|
|
53
|
-
|
|
54
|
-
<div class="text">
|
|
55
|
-
<p>
|
|
56
|
-
<%= label_tag :recover_email, "Email:" %>
|
|
57
|
-
<%= text_field_tag :recover_email, params[:recover_email], :class => "caseinTextField" %>
|
|
58
|
-
</p>
|
|
59
|
-
</div>
|
|
60
|
-
<div class="submit_remember">
|
|
61
|
-
<p>
|
|
62
|
-
<%= submit_tag "Reset", :class => "caseinSubmit" %>
|
|
63
|
-
</p>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
<% end %>
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<h2>Users</h2>
|
|
2
|
-
|
|
3
|
-
<table cellpadding="0" cellspacing="0" id="itemList" class="itemList">
|
|
4
|
-
<tr>
|
|
5
|
-
<th>Login</th>
|
|
6
|
-
<th>Name</th>
|
|
7
|
-
<th>Status</th>
|
|
8
|
-
<th> </th>
|
|
9
|
-
</tr>
|
|
10
|
-
|
|
11
|
-
<% @users.each_with_index do |user, index| %>
|
|
12
|
-
<tr class="<%= 'even' if index.modulo(2) == 0 %> hover">
|
|
13
|
-
<td><%= casein_table_cell_link user.login, casein_user_path(user) %></td>
|
|
14
|
-
<td><%= casein_table_cell_link user.name, casein_user_path(user) %></td>
|
|
15
|
-
<td><%= casein_table_cell_link casein_get_access_level_text(user.access_level), casein_user_path(user) %></td>
|
|
16
|
-
<td class="delete">
|
|
17
|
-
<% if user.is_admin? == false || Casein::User.has_more_than_one_admin %>
|
|
18
|
-
<% confirm_message = "Are you sure you want to delete #{user.name}?" %>
|
|
19
|
-
|
|
20
|
-
<% if user.id == @session_user.id %>
|
|
21
|
-
<% confirm_message += "\n\nWARNING: This is your user account. You will be logged out if you proceed." %>
|
|
22
|
-
<% end %>
|
|
23
|
-
|
|
24
|
-
<%= link_to(casein_show_row_icon("delete"), casein_user_path(user), :method => :delete, :data => { :confirm => confirm_message }) %>
|
|
25
|
-
<% end %>
|
|
26
|
-
</td>
|
|
27
|
-
</tr>
|
|
28
|
-
<% end %>
|
|
29
|
-
</table>
|
|
30
|
-
|
|
31
|
-
<%= will_paginate @users %>
|
|
32
|
-
|
|
33
|
-
<%= content_for :sidebar do %>
|
|
34
|
-
<li><%= link_to "#{casein_show_icon('add')}Add a new user".html_safe, new_casein_user_path %></li>
|
|
35
|
-
<% end %>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<h2>Add a new user</h2>
|
|
2
|
-
|
|
3
|
-
<%= form_for @casein_user do |form| %>
|
|
4
|
-
|
|
5
|
-
<div class="tfContainer">
|
|
6
|
-
<%= casein_text_field form, @casein_user, :login, {:size => 30} %>
|
|
7
|
-
</div>
|
|
8
|
-
|
|
9
|
-
<div class="tfContainer tfContainerSecond">
|
|
10
|
-
<%= casein_text_field form, @casein_user, :name %>
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
<div class="tfContainer">
|
|
14
|
-
<%= casein_text_field form, @casein_user, :email %>
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
<div class="tfContainer tfContainerSecond">
|
|
18
|
-
<%= casein_time_zone_select form, @casein_user, :time_zone, ActiveSupport::TimeZone.us_zones %>
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
<div class="tfContainer">
|
|
22
|
-
<%= casein_select form, @casein_user, :access_level, casein_get_access_level_array, {:casein_label => "Status"} %>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<div class="tfContainer tfContainerSecond">
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<div class="tfContainer">
|
|
29
|
-
<%= casein_password_field form, @casein_user, :password, {:casein_label => "Password"} %>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<div class="tfContainer tfContainerSecond">
|
|
33
|
-
<%= casein_password_field form, @casein_user, :password_confirmation, {:casein_label => "Repeat password"} %>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<div class="clearer"></div>
|
|
37
|
-
|
|
38
|
-
<p class="submits">
|
|
39
|
-
<%= form.submit "Add new user", :class => "update" %>
|
|
40
|
-
</p>
|
|
41
|
-
|
|
42
|
-
<% end %>
|
|
43
|
-
|
|
44
|
-
<%= content_for :sidebar do %>
|
|
45
|
-
<li><%= link_to "#{casein_show_icon('table')}Back to list".html_safe, casein_users_path %></li>
|
|
46
|
-
<% end %>
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
<h2>View user</h2>
|
|
2
|
-
|
|
3
|
-
<%= form_for @casein_user do |f| %>
|
|
4
|
-
|
|
5
|
-
<div class="tfContainer">
|
|
6
|
-
<%= casein_text_field f, f.object, :login, {:size => 30} %>
|
|
7
|
-
</div>
|
|
8
|
-
|
|
9
|
-
<div class="tfContainer tfContainerSecond">
|
|
10
|
-
<%= casein_text_field f, f.object, :name %>
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
<div class="tfContainer">
|
|
14
|
-
<%= casein_text_field f, f.object, :email %>
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
<div class="tfContainer tfContainerSecond">
|
|
18
|
-
<%= casein_time_zone_select f, f.object, :time_zone, ActiveSupport::TimeZone.us_zones %>
|
|
19
|
-
</div>
|
|
20
|
-
|
|
21
|
-
<% if @session_user.is_admin? && (@casein_user.is_admin? == false || Casein::User.has_more_than_one_admin) %>
|
|
22
|
-
<div class="tfContainer">
|
|
23
|
-
<%= casein_select f, f.object, :access_level, casein_get_access_level_array, {:casein_label => "Status"} %>
|
|
24
|
-
</div>
|
|
25
|
-
<div class="tfContainer tfContainerSecond">
|
|
26
|
-
</div>
|
|
27
|
-
<% end %>
|
|
28
|
-
|
|
29
|
-
<div class="clearer"></div>
|
|
30
|
-
|
|
31
|
-
<p class="submits">
|
|
32
|
-
<%= link_to 'Cancel', casein_users_path, :class => 'cancel' %> or
|
|
33
|
-
<%= f.submit "Save changes", :class => "update" %>
|
|
34
|
-
</p>
|
|
35
|
-
<% end %>
|
|
36
|
-
|
|
37
|
-
<% if @session_user.is_admin? %>
|
|
38
|
-
|
|
39
|
-
<h2>Reset password (admin action - use carefully)</h2>
|
|
40
|
-
|
|
41
|
-
<%= form_for @casein_user, :url => reset_password_casein_user_path(@casein_user) do |f| %>
|
|
42
|
-
|
|
43
|
-
<div class="tfContainer">
|
|
44
|
-
<%= casein_password_field f, f.object, :password, {:casein_label => "New password"} %>
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<div class="tfContainer tfContainerSecond">
|
|
48
|
-
<%= casein_password_field f, f.object, :password_confirmation, {:casein_label => "Repeat password"} %>
|
|
49
|
-
</div>
|
|
50
|
-
|
|
51
|
-
<div class="clearer"></div>
|
|
52
|
-
|
|
53
|
-
<p class="submits">
|
|
54
|
-
<%= f.submit "Reset", :class => "update" %>
|
|
55
|
-
</p>
|
|
56
|
-
|
|
57
|
-
<% end %>
|
|
58
|
-
|
|
59
|
-
<% elsif @session_user.id == @casein_user.id %>
|
|
60
|
-
|
|
61
|
-
<h2>Change password</h2>
|
|
62
|
-
|
|
63
|
-
<%= form_for @casein_user, :url => update_password_casein_user_path(@casein_user) do |f| %>
|
|
64
|
-
|
|
65
|
-
<div class="tfContainer">
|
|
66
|
-
<p><%= label_tag :form_current_password, "Current password" %></p>
|
|
67
|
-
<p><%= password_field_tag :form_current_password, "", {:class => 'caseinTextField'} %></p>
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
<div class="tfContainer tfContainerSecond">
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
<div class="tfContainer">
|
|
74
|
-
<%= casein_password_field f, f.object, :password, {:casein_label => "New password"} %>
|
|
75
|
-
</div>
|
|
76
|
-
|
|
77
|
-
<div class="tfContainer tfContainerSecond">
|
|
78
|
-
<%= casein_password_field f, f.object, :password_confirmation, {:casein_label => "Repeat password"} %>
|
|
79
|
-
</div>
|
|
80
|
-
|
|
81
|
-
<div class="clearer"></div>
|
|
82
|
-
|
|
83
|
-
<p class="submits">
|
|
84
|
-
<%= f.submit "Change", :class => "update" %>
|
|
85
|
-
</p>
|
|
86
|
-
|
|
87
|
-
<% end %>
|
|
88
|
-
<% end %>
|
|
89
|
-
|
|
90
|
-
<%= content_for :sidebar do %>
|
|
91
|
-
<% if @session_user.is_admin? %>
|
|
92
|
-
<li><%= link_to "#{casein_show_icon('table')}Back to list".html_safe, casein_users_path %></li>
|
|
93
|
-
<% end %>
|
|
94
|
-
<% end %>
|
data/lib/generators/casein/install/templates/app/views/casein/layouts/_right_navigation.html.erb
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<li id="visitSite"><%= link_to "Visit site", casein_config_hostname, :target => "_blank" %></li>
|