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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f90c1e3395d45e3a5e48b296d5176c88dd3701ab
4
- data.tar.gz: 6425455e234a5ccadc3fcc38f668578de9ba90c3
3
+ metadata.gz: bf20305470b452af36fca1e23124a676b61cdc50
4
+ data.tar.gz: 44b05c92f01040378720ba77e614a650f60d18d5
5
5
  SHA512:
6
- metadata.gz: ce5ec2edd76b476e08e23d2b2129bdae35b285a448ca372c490dc09efdc7043b5779f5f94054775079f0c0b93fd23ab96777ae2938cdb8f97b7e39ebf9b60f8b
7
- data.tar.gz: 77e0e1dd611e1d6d9e44fadb0b234d86787dba522c993a390f81e0d03319a9d042fd7d78ad3a1fbeb8d1fb923cc7f8cf6f43bd34b7ce085f4102eb16f087fc32
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
- var sibling = activeItem.next();
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
  }
@@ -26,6 +26,10 @@ tb.util = {
26
26
  parts.push(tb.config.subUri);
27
27
  }
28
28
  return parts.concat(args).join('/');
29
+ },
30
+
31
+ getCsrfToken: function(){
32
+ return $('meta[name=csrf-token]').attr('content');
29
33
  }
30
34
  };
31
35
 
@@ -218,6 +218,9 @@ div.field_with_errors label {
218
218
 
219
219
 
220
220
  /*Table Layout*/
221
+ td.no-wrap{
222
+ white-space: nowrap;
223
+ }
221
224
  .admin-table {
222
225
  width:100%;
223
226
  border:1px solid #eee;
@@ -1,5 +1,7 @@
1
1
  class Spud::ApplicationController < ActionController::Base
2
2
 
3
+ ActiveSupport.run_load_hooks(:spud_application_controller, self)
4
+
3
5
  protect_from_forgery
4
6
  helper_method :current_user_session, :current_user, :current_user_id
5
7
  around_filter :set_time_zone
@@ -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
- self.last_request_at_threshold = 1.minutes
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,:class=>"control-label"%>
6
+ <%= f.label :login, :required => true, :class => "control-label" %>
7
7
  <div class="controls">
8
- <%=f.text_field :login,:title => "",:size=>25%>
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, :title => "",:size => 25%>
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, :title => "",:size => 25%>
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%>.each do |<%=module_name_formatted.singularize%>| %>
12
- <tr>
13
- <%-attributes.each do |attribute|-%>
14
- <%-attribute_args = attribute.split(":")-%>
15
- <td><%%= <%=module_name_formatted.singularize%>.<%=attribute_args[0]%> %></td>
16
- <%-end-%>
17
- <td><%%= link_to 'Details', <%=module_name_formatted.singularize%>_path(<%=module_name_formatted.singularize%>) %></td>
18
- </tr>
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>
@@ -1,6 +1,8 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
4
6
  <%%= tb_page_title() %>
5
7
  <%%= stylesheet_link_tag "application", :media => "all" %>
6
8
  <%%= javascript_include_tag "application" %>
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Core
3
- VERSION = "1.2.3"
3
+ VERSION = "1.2.4"
4
4
  end
5
5
  end
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.3
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-06-06 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails