tb_core 1.2.3 → 1.2.4
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/app/assets/javascripts/admin/core/split_pane.js +13 -5
- data/app/assets/javascripts/tb_core/utility.js +4 -0
- data/app/assets/stylesheets/admin/core/application.css.scss +3 -0
- data/app/controllers/spud/application_controller.rb +2 -0
- data/app/helpers/admin/application_helper.rb +37 -0
- data/app/models/spud/spud_user_model.rb +1 -0
- data/app/models/spud_user_session.rb +10 -1
- data/app/views/admin/settings/_form.html.erb +6 -6
- data/app/views/admin/user_sessions/new.html.erb +2 -2
- data/app/views/admin/users/index.html.erb +1 -1
- data/app/views/user_sessions/new.html.erb +2 -2
- data/lib/generators/spud/templates/views/frontend/index.html.erb +12 -8
- data/lib/generators/spud/templates/views/layouts/application.html.erb +2 -0
- data/lib/spud_core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf20305470b452af36fca1e23124a676b61cdc50
|
4
|
+
data.tar.gz: 44b05c92f01040378720ba77e614a650f60d18d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35dd3f7a88ac1603d596f57b60aeadb1d3e7a0a7e9e04bca110dba34d0fa48f742c87242ce6dba1a9877aca5a12adfa0c97b88ca40a844e6ca1fb530d3038219
|
7
|
+
data.tar.gz: 45f61b833bb35b052c952d0a612fd0019f3b113a434b01110b4428dcf6768e06bae391fb7949e6e27be9b847dee51cbf6eec371cb05dcfffa82f604f29399953
|
@@ -115,13 +115,21 @@ spud.admin.SplitPane = (function(){
|
|
115
115
|
return this.contentArea.html();
|
116
116
|
};
|
117
117
|
|
118
|
+
SplitPane.prototype.getPreviousItem = function(){
|
119
|
+
var activeItem = this.getActiveItem();
|
120
|
+
var prev = activeItem.prev(".split-pane-item")[0] || activeItem.siblings(".split-pane-item").last()[0];
|
121
|
+
return prev;
|
122
|
+
};
|
123
|
+
|
124
|
+
SplitPane.prototype.getNextItem = function(){
|
125
|
+
var activeItem = this.getActiveItem();
|
126
|
+
return activeItem.next(".split-pane-item")[0];
|
127
|
+
};
|
128
|
+
|
118
129
|
SplitPane.prototype.removeCurrentlySelectedItem = function(){
|
130
|
+
var sibling = this.getNextItem() || this.getPreviousItem();
|
119
131
|
var activeItem = this.getActiveItem();
|
120
|
-
|
121
|
-
if(!sibling){
|
122
|
-
sibling = activeItem.prev();
|
123
|
-
}
|
124
|
-
this.getActiveItem().remove();
|
132
|
+
activeItem.remove();
|
125
133
|
if(sibling){
|
126
134
|
sibling.click();
|
127
135
|
}
|
@@ -46,4 +46,41 @@ module Admin::ApplicationHelper
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
# Build a Bootstrap nav-tabs element
|
50
|
+
#
|
51
|
+
# * url_helper: A symbol representing the url helper method. ie: admin_widgets_path
|
52
|
+
# * tabs: An array of tab hashes with :title and :value keys
|
53
|
+
#
|
54
|
+
# Example:
|
55
|
+
#
|
56
|
+
# <%= tb_core_tabbed_navigation(:admin_vehicles_path, [
|
57
|
+
# {:title => 'All'},
|
58
|
+
# {:title => 'New', :value => 'new'},
|
59
|
+
# {:title => 'Used', :value => 'used'}
|
60
|
+
# ]) %>
|
61
|
+
#
|
62
|
+
# This would generate:
|
63
|
+
#
|
64
|
+
# <ul class="nav nav-tabs">
|
65
|
+
# <li class="active"><a href="/admin/vehicles">All</a></li>
|
66
|
+
# <li class=""><a href="/admin/vehicles?tab=new">New</a></li>
|
67
|
+
# <li class=""><a href="/admin/vehicles?tab=used">Used</a></li>
|
68
|
+
# </ul>
|
69
|
+
#
|
70
|
+
def tb_core_tabbed_navigation(url_helper, tabs)
|
71
|
+
key = :tab
|
72
|
+
content_tag :ul, :class => 'nav nav-tabs' do
|
73
|
+
tabs.each do |tab|
|
74
|
+
cls = params[key] == tab[:value] ? 'active' : ''
|
75
|
+
url = tab.delete(:url)
|
76
|
+
if url.blank?
|
77
|
+
id_params = params.select{ |k,v| k == :id || k.to_s =~ /_id$/ }
|
78
|
+
link_args = id_params.merge(key => tab[:value])
|
79
|
+
url = self.send(url_helper, link_args)
|
80
|
+
end
|
81
|
+
concat(content_tag(:li, :class => cls){ link_to tab[:title], url })
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
49
86
|
end
|
@@ -4,6 +4,7 @@ class Spud::SpudUserModel < ActiveRecord::Base
|
|
4
4
|
acts_as_authentic do |c|
|
5
5
|
c.transition_from_crypto_providers = Authlogic::CryptoProviders::Sha512,
|
6
6
|
c.crypto_provider = Authlogic::CryptoProviders::SCrypt
|
7
|
+
c.logged_in_timeout = 24.hours
|
7
8
|
end
|
8
9
|
|
9
10
|
belongs_to :role, :class_name => 'SpudRole', :foreign_key => 'spud_role_id'
|
@@ -1,4 +1,13 @@
|
|
1
1
|
class SpudUserSession < Authlogic::Session::Base
|
2
2
|
generalize_credentials_error_messages true
|
3
|
-
|
3
|
+
|
4
|
+
# Dont update last_request_at timestamp on every page request
|
5
|
+
last_request_at_threshold 1.minutes
|
6
|
+
|
7
|
+
# Lock a user out after 10 failed login attempts, for 1 hour
|
8
|
+
consecutive_failed_logins_limit 10
|
9
|
+
failed_login_ban_for 1.hours
|
10
|
+
|
11
|
+
# Log a user out after :logged_in_timeout has elapsed - see SpudUserModel for configuration
|
12
|
+
logout_on_timeout true
|
4
13
|
end
|
@@ -3,9 +3,9 @@
|
|
3
3
|
<legend>User Details</legend>
|
4
4
|
|
5
5
|
<div class="control-group">
|
6
|
-
<%=f.label :login, :required=>true
|
6
|
+
<%= f.label :login, :required => true, :class => "control-label" %>
|
7
7
|
<div class="controls">
|
8
|
-
<%=f.text_field :login
|
8
|
+
<%= f.text_field :login, :size => 25, :autocomplete => 'username' %>
|
9
9
|
</div>
|
10
10
|
|
11
11
|
</div>
|
@@ -41,17 +41,17 @@
|
|
41
41
|
<legend>Credentials</legend>
|
42
42
|
|
43
43
|
<div class="control-group">
|
44
|
-
<%=f.label :password,:class=>"control-label"%>
|
44
|
+
<%= f.label :password,:class=>"control-label" %>
|
45
45
|
<div class="controls">
|
46
|
-
<%=f.password_field :password, :
|
46
|
+
<%= f.password_field :password, :size => 25, :autocomplete => 'new-password' %>
|
47
47
|
<p class="help-block">Password must be at least 8 characters</p>
|
48
48
|
</div>
|
49
49
|
|
50
50
|
</div>
|
51
51
|
<div class="control-group">
|
52
|
-
<%=f.label :password_confirmation,"Confirm",:class=>"control-label"%>
|
52
|
+
<%= f.label :password_confirmation,"Confirm",:class=>"control-label" %>
|
53
53
|
<div class="controls">
|
54
|
-
<%=f.password_field :password_confirmation, :
|
54
|
+
<%= f.password_field :password_confirmation, :size => 25, :autocomplete => 'new-password' %>
|
55
55
|
<p class="help-block">Retype your password here.</p>
|
56
56
|
</div>
|
57
57
|
|
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
<div class="login-form-row">
|
6
6
|
<%= f.label :login %>
|
7
|
-
<%= f.text_field :login, :autofocus => 'autofocus' %>
|
7
|
+
<%= f.text_field :login, :autofocus => 'autofocus', :autocomplete => 'username' %>
|
8
8
|
</div>
|
9
9
|
<div class="login-form-row">
|
10
10
|
<%= f.label :password %>
|
11
|
-
<%= f.password_field :password %>
|
11
|
+
<%= f.password_field :password, :autocomplete => 'current-password' %>
|
12
12
|
</div>
|
13
13
|
<div class="login-form-row">
|
14
14
|
<%= f.submit "Login", :class => 'btn' %> or <%=link_to "Forgot Password?", admin_password_resets_path %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= content_for :data_controls do %>
|
2
2
|
<%= link_to raw('<i class="icon-refresh"></i>'), '#', :class => 'btn split-pane-refresh-btn' %>
|
3
|
-
<%= link_to 'Roles', admin_roles_path, :class => 'btn' %>
|
3
|
+
<%= link_to 'Roles', admin_roles_path, :class => 'btn admin-role-btn' %>
|
4
4
|
<%= link_to "New User", new_admin_user_path, :class => "btn btn-primary admin-user-add-btn", :title => "New User" %>
|
5
5
|
<% end %>
|
6
6
|
|
@@ -6,11 +6,11 @@
|
|
6
6
|
<%= tb_form_errors(@user_session) %>
|
7
7
|
<div class="form-row">
|
8
8
|
<%= f.label :login %>
|
9
|
-
<%= f.text_field :login, :placeholder => 'username', :autofocus => 'autofocus' %>
|
9
|
+
<%= f.text_field :login, :placeholder => 'username', :autofocus => 'autofocus', :autocomplete => 'username' %>
|
10
10
|
</div>
|
11
11
|
<div class="form-row">
|
12
12
|
<%= f.label :password %>
|
13
|
-
<%= f.password_field :password, :placeholder => 'password' %>
|
13
|
+
<%= f.password_field :password, :placeholder => 'password', :autocomplete => 'current-password' %>
|
14
14
|
</div>
|
15
15
|
<div class="form-row">
|
16
16
|
<%= f.submit "Login", :class => 'btn btn-primary' %> <span>or</span> <%=link_to "Forgot Password?", password_resets_path %>
|
@@ -8,14 +8,18 @@
|
|
8
8
|
</tr>
|
9
9
|
</thead>
|
10
10
|
<tbody>
|
11
|
-
<%% @<%=module_name_formatted
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
<%% cache(cache_key_for_spud_collection(@<%=module_name_formatted%>)) do %>
|
12
|
+
<%% @<%=module_name_formatted%>.each do |<%=module_name_formatted.singularize%>| %>
|
13
|
+
<%% cache(<%=module_name_formatted.singularize%>) do %>
|
14
|
+
<tr>
|
15
|
+
<%-attributes.each do |attribute|-%>
|
16
|
+
<%-attribute_args = attribute.split(":")-%>
|
17
|
+
<td><%%= <%=module_name_formatted.singularize%>.<%=attribute_args[0]%> %></td>
|
18
|
+
<%-end-%>
|
19
|
+
<td><%%= link_to 'Details', <%=module_name_formatted.singularize%>_path(<%=module_name_formatted.singularize%>) %></td>
|
20
|
+
</tr>
|
21
|
+
<%% end %>
|
22
|
+
<%% end %>
|
19
23
|
<%% end %>
|
20
24
|
</tbody>
|
21
25
|
</table>
|
data/lib/spud_core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tb_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Woods
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|