tb_core 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d4b115f542bdd9445a2a32b9d1d0ea8a664c6ae
4
- data.tar.gz: c77ab9bab3976d0c567ea557111991b1b45a8388
3
+ metadata.gz: ea94ad2b31aa8101ada58693ddce6affcee319f7
4
+ data.tar.gz: c8b4cb521289d7e72c94bb2ecd5d59c7fc5cfbae
5
5
  SHA512:
6
- metadata.gz: e6b8e1f29af8d51135fb1a724eecceacb31f3bf9d43ec9ca3e2496bdb93c4aecb21027d81ecbd9b4a3e5be3c140b137f2257a799b4cd142cdca5e090c098a3bb
7
- data.tar.gz: 13e3206f5b3327ad0473cce81d1869552227c227772fe41cefddd72afe685867ca2e120111e8bf17b89a4864130f55a4a1ef1ae72721657f04fb30c46f4631de
6
+ metadata.gz: 0b39a3ab868cd6a460166c6074824686f505d51f31346221254640dafa3f47e14243aa03122080721742897125c8fdfc33954375cc36b0e7fb5f8f101e65de40
7
+ data.tar.gz: af470fafae79bd093feb82ba50e8afb1a8fa67c9e68ec85d065ef758ef78b3efa451a6f5aa71aab4399b31ef7f7873831572608e9125d121153d2f48d7051061
@@ -3,7 +3,7 @@ spud.admin.editor = {};
3
3
  (function(){
4
4
 
5
5
  var editor = spud.admin.editor;
6
-
6
+
7
7
  editor.tinymce = {loaded:false};
8
8
 
9
9
  var registeredPlugins = [
@@ -57,7 +57,7 @@ spud.admin.editor = {};
57
57
  var buttons = options.buttons || registeredButtons;
58
58
  var plugins = options.plugins || registeredPlugins;
59
59
 
60
- $(element).tinymce({
60
+ $(element).tinymce({
61
61
  theme: theme,
62
62
  language: 'en',
63
63
  menubar: false,
@@ -110,7 +110,7 @@ spud.admin.editor = {};
110
110
  registeredButtons.push(buttonNameOrArray);
111
111
  }
112
112
  };
113
-
113
+
114
114
  var loadScript = null;
115
115
 
116
116
  editor.checkAndCallTinyMce = function(options){
@@ -124,7 +124,7 @@ spud.admin.editor = {};
124
124
 
125
125
  if(loadScript === null){
126
126
  loadScript = $.when(
127
- $.ajax({url: '//cdn.tinymce.com/4.3/tinymce.jquery.min.js', dataType: 'script', cache: true}),
127
+ $.ajax({url: '//cdn.tinymce.com/4.3/tinymce.min.js', dataType: 'script', cache: true}),
128
128
  $.ajax({url: '//cdn.tinymce.com/4.3/jquery.tinymce.min.js', dataType: 'script', cache: true})
129
129
  ).done(function(){
130
130
  $('body').trigger("tb:tinymce-loaded");
@@ -13,7 +13,7 @@ spud.admin.users = {
13
13
  $picker.on('change', changedUserSelect).trigger('change');
14
14
  $body.on('click', '.tb-user-select-edit', clickedPickerEdit);
15
15
  $body.on('click', '.tb-user-select-add', clickedPickerAdd);
16
- $('.modal-body').on('ajax:success', '.user-form', savedModalUser);
16
+ $('.modal-body').on('ajax:success', '.user-form', savedModalUser);
17
17
  }
18
18
  }
19
19
  };
@@ -108,7 +108,8 @@ var clickedPickerAdd = function(e){
108
108
  /*
109
109
  * When a user is saved, close the modal and update the picker
110
110
  */
111
- var savedModalUser = function(event, json, textStatus, jqXHR){
111
+ var savedModalUser = function(event){
112
+ var json = event.originalEvent.detail[0]
112
113
  var $option = $('<option/>', {
113
114
  value: json.id,
114
115
  text: json.first_name + ' ' + json.last_name + ' (' + json.email + ')'
@@ -1,18 +1,24 @@
1
1
  module Admin::ApplicationHelper
2
2
 
3
- def timestamp(timedate=nil)
4
- return 'Never' if timedate.blank?
3
+ def timestamp(datetime=nil)
4
+ return 'Never' if datetime.blank?
5
5
 
6
- if Time.now() > timedate # in the past
7
- if Time.now() - timedate > 604800
8
- return timedate.strftime('%B %d, %Y') + ' at ' + timedate.strftime('%I:%M %p')
6
+ content_tag :span,
7
+ determine_fancy_timestmap(datetime),
8
+ title: datetime
9
+ end
10
+
11
+ def determine_fancy_timestmap(datetime)
12
+ if Time.now() > datetime # in the past
13
+ if Time.now() - datetime > 604800
14
+ datetime.strftime('%B %d, %Y') + ' at ' + datetime.strftime('%I:%M %p')
9
15
  else
10
- return time_ago_in_words(timedate) + ' ago'
16
+ time_ago_in_words(datetime) + ' ago'
11
17
  end
12
- elsif Time.now() < timedate # in the future
13
- return timedate.strftime('%B %d, %Y') + ' at ' + timedate.strftime('%I:%M %p')
18
+ elsif Time.now() < datetime # in the future
19
+ datetime.strftime('%B %d, %Y') + ' at ' + datetime.strftime('%I:%M %p')
14
20
  else
15
- return 'Right now'
21
+ 'Right now'
16
22
  end
17
23
  end
18
24
 
@@ -19,7 +19,7 @@
19
19
  <tr>
20
20
  <td><%= spud_user.full_name %></td>
21
21
  <td><%= mail_to spud_user.email %></td>
22
- <td><%= timestamp(spud_user.current_login_at) %></td>
22
+ <td><%= timestamp spud_user.current_login_at %></td>
23
23
  <td class="table-actions">
24
24
  <%= link_to 'Details', admin_user_path(spud_user), :class => 'btn btn-default btn-sm' %>
25
25
  <%= link_to 'Edit', edit_admin_user_path(spud_user), :class => 'btn btn-default btn-sm' %>
@@ -10,7 +10,7 @@
10
10
  <dt>Email</dt>
11
11
  <dd><%= mail_to @user.email %></dd>
12
12
  <dt>Last Login</dt>
13
- <dd><%= timestamp @user.last_login_at %></dd>
13
+ <dd><%= timestamp @user.current_login_at %></dd>
14
14
  <dt>Created At</dt>
15
15
  <dd><%= timestamp @user.created_at %></dd>
16
16
  <dt>Role:</dt>
@@ -1,4 +1,4 @@
1
- class CreateSpudAdminPermissions < ActiveRecord::Migration
1
+ class CreateSpudAdminPermissions < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :spud_admin_permissions do |t|
4
4
  t.integer :user_id
@@ -1,4 +1,4 @@
1
- class CreateSpudUsers < ActiveRecord::Migration
1
+ class CreateSpudUsers < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :spud_users do |t|
4
4
 
@@ -1,4 +1,4 @@
1
- class AddTimeZoneToSpudUser < ActiveRecord::Migration
1
+ class AddTimeZoneToSpudUser < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spud_users, :time_zone, :string
4
4
 
@@ -1,4 +1,4 @@
1
- class AddScopeToSpudAdminPermissions < ActiveRecord::Migration
1
+ class AddScopeToSpudAdminPermissions < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spud_admin_permissions, :scope, :string
4
4
 
@@ -1,4 +1,4 @@
1
- class CreateSpudUserSettings < ActiveRecord::Migration
1
+ class CreateSpudUserSettings < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :spud_user_settings do |t|
4
4
  t.integer :spud_user_id
@@ -1,4 +1,4 @@
1
- class CreateSpudRoles < ActiveRecord::Migration
1
+ class CreateSpudRoles < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :spud_roles do |t|
4
4
  t.string :name
@@ -1,4 +1,4 @@
1
- class CreateSpudPermissions < ActiveRecord::Migration
1
+ class CreateSpudPermissions < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :spud_permissions do |t|
4
4
  t.string :name, :null => false
@@ -1,4 +1,4 @@
1
- class CreateSpudRolePermissions < ActiveRecord::Migration
1
+ class CreateSpudRolePermissions < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :spud_role_permissions do |t|
4
4
  t.integer :spud_role_id, :null => false
@@ -1,4 +1,4 @@
1
- class DropSpudAdminPermissions < ActiveRecord::Migration
1
+ class DropSpudAdminPermissions < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  drop_table :spud_admin_permissions
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddRequiresPasswordChangeToSpudUsers < ActiveRecord::Migration
1
+ class AddRequiresPasswordChangeToSpudUsers < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :spud_users, :requires_password_change, :boolean, :default => false
4
4
  end
@@ -6,6 +6,7 @@ require 'autoprefixer-rails'
6
6
  require 'will_paginate'
7
7
  require 'will_paginate-bootstrap'
8
8
  require 'breadcrumbs_on_rails'
9
+ require 'rails-ujs'
9
10
 
10
11
  # this should eventually replace the Spud::Core namespace
11
12
  module TbCore
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Core
3
- VERSION = '1.4.2'.freeze
3
+ VERSION = '1.4.3'.freeze
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.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Woods
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-04 00:00:00.000000000 Z
11
+ date: 2017-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rails-ujs
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: breadcrumbs_on_rails
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -293,7 +307,6 @@ files:
293
307
  - app/assets/libs/datepicker/css/datepicker.css
294
308
  - app/assets/libs/datepicker/js/bootstrap-datepicker.js
295
309
  - app/assets/libs/datepicker/less/datepicker.less
296
- - app/assets/libs/rails-ujs.js
297
310
  - app/assets/libs/sortable/sortable.js
298
311
  - app/assets/stylesheets/admin/application.css
299
312
  - app/assets/stylesheets/admin/core/application.scss
@@ -339,7 +352,6 @@ files:
339
352
  - app/views/admin/user_sessions/new.html.erb
340
353
  - app/views/admin/users/_form.html.erb
341
354
  - app/views/admin/users/_form_additions.html.erb
342
- - app/views/admin/users/_index.html.erb
343
355
  - app/views/admin/users/_show_additions.html.erb
344
356
  - app/views/admin/users/edit.html.erb
345
357
  - app/views/admin/users/index.html.erb
@@ -1,705 +0,0 @@
1
- // https://github.com/rails/rails-ujs
2
-
3
- (function() {
4
- (function() {
5
- (function() {
6
- this.Rails = {
7
- linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',
8
- buttonClickSelector: {
9
- selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])',
10
- exclude: 'form button'
11
- },
12
- inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
13
- formSubmitSelector: 'form',
14
- formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])',
15
- formDisableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled',
16
- formEnableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled',
17
- requiredInputSelector: 'input[name][required]:not([disabled]), textarea[name][required]:not([disabled])',
18
- fileInputSelector: 'input[name][type=file]:not([disabled])',
19
- linkDisableSelector: 'a[data-disable-with], a[data-disable]',
20
- buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'
21
- };
22
-
23
- }).call(this);
24
- }).call(this);
25
-
26
- var Rails = this.Rails;
27
-
28
- (function() {
29
- (function() {
30
- var expando, m;
31
-
32
- m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;
33
-
34
- Rails.matches = function(element, selector) {
35
- if (selector.exclude != null) {
36
- return m.call(element, selector.selector) && !m.call(element, selector.exclude);
37
- } else {
38
- return m.call(element, selector);
39
- }
40
- };
41
-
42
- expando = '_ujsData';
43
-
44
- Rails.getData = function(element, key) {
45
- var ref;
46
- return (ref = element[expando]) != null ? ref[key] : void 0;
47
- };
48
-
49
- Rails.setData = function(element, key, value) {
50
- if (element[expando] == null) {
51
- element[expando] = {};
52
- }
53
- return element[expando][key] = value;
54
- };
55
-
56
- Rails.$ = function(selector) {
57
- return Array.prototype.slice.call(document.querySelectorAll(selector));
58
- };
59
-
60
- }).call(this);
61
- (function() {
62
- var $, csrfParam, csrfToken;
63
-
64
- $ = Rails.$;
65
-
66
- csrfToken = Rails.csrfToken = function() {
67
- var meta;
68
- meta = document.querySelector('meta[name=csrf-token]');
69
- return meta && meta.content;
70
- };
71
-
72
- csrfParam = Rails.csrfParam = function() {
73
- var meta;
74
- meta = document.querySelector('meta[name=csrf-param]');
75
- return meta && meta.content;
76
- };
77
-
78
- Rails.CSRFProtection = function(xhr) {
79
- var token;
80
- token = csrfToken();
81
- if (token != null) {
82
- return xhr.setRequestHeader('X-CSRF-Token', token);
83
- }
84
- };
85
-
86
- Rails.refreshCSRFTokens = function() {
87
- var param, token;
88
- token = csrfToken();
89
- param = csrfParam();
90
- if ((token != null) && (param != null)) {
91
- return $('form input[name="' + param + '"]').forEach(function(input) {
92
- return input.value = token;
93
- });
94
- }
95
- };
96
-
97
- }).call(this);
98
- (function() {
99
- var CustomEvent, fire, matches;
100
-
101
- matches = Rails.matches;
102
-
103
- CustomEvent = window.CustomEvent;
104
-
105
- if (typeof CustomEvent === 'function') {
106
- CustomEvent = function(event, params) {
107
- var evt;
108
- evt = document.createEvent('CustomEvent');
109
- evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
110
- return evt;
111
- };
112
- CustomEvent.prototype = window.Event.prototype;
113
- }
114
-
115
- fire = Rails.fire = function(obj, name, data) {
116
- var event;
117
- event = new CustomEvent(name, {
118
- bubbles: true,
119
- cancelable: true,
120
- detail: data
121
- });
122
- obj.dispatchEvent(event);
123
- return !event.defaultPrevented;
124
- };
125
-
126
- Rails.stopEverything = function(e) {
127
- fire(e.target, 'ujs:everythingStopped');
128
- e.preventDefault();
129
- e.stopPropagation();
130
- return e.stopImmediatePropagation();
131
- };
132
-
133
- Rails.delegate = function(element, selector, eventType, handler) {
134
- return element.addEventListener(eventType, function(e) {
135
- var target;
136
- target = e.target;
137
- while (!(!(target instanceof Element) || matches(target, selector))) {
138
- target = target.parentNode;
139
- }
140
- if (target instanceof Element && handler.call(target, e) === false) {
141
- e.preventDefault();
142
- return e.stopPropagation();
143
- }
144
- });
145
- };
146
-
147
- }).call(this);
148
- (function() {
149
- var AcceptHeaders, CSRFProtection, createXHR, fire, prepareOptions, processResponse;
150
-
151
- CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;
152
-
153
- AcceptHeaders = {
154
- '*': '*/*',
155
- text: 'text/plain',
156
- html: 'text/html',
157
- xml: 'application/xml, text/xml',
158
- json: 'application/json, text/javascript',
159
- script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'
160
- };
161
-
162
- Rails.ajax = function(options) {
163
- var xhr;
164
- options = prepareOptions(options);
165
- xhr = createXHR(options, function() {
166
- var response;
167
- response = processResponse(xhr.response, xhr.getResponseHeader('Content-Type'));
168
- if (Math.floor(xhr.status / 100) === 2) {
169
- if (typeof options.success === "function") {
170
- options.success(response, xhr.statusText, xhr);
171
- }
172
- } else {
173
- if (typeof options.error === "function") {
174
- options.error(response, xhr.statusText, xhr);
175
- }
176
- }
177
- return typeof options.complete === "function" ? options.complete(xhr, xhr.statusText) : void 0;
178
- });
179
- if (typeof options.beforeSend === "function") {
180
- options.beforeSend(xhr, options);
181
- }
182
- if (xhr.readyState === XMLHttpRequest.OPENED) {
183
- return xhr.send(options.data);
184
- } else {
185
- return fire(document, 'ajaxStop');
186
- }
187
- };
188
-
189
- prepareOptions = function(options) {
190
- options.type = options.type.toUpperCase();
191
- if (options.type === 'GET' && options.data) {
192
- if (options.url.indexOf('?') < 0) {
193
- options.url += '?' + options.data;
194
- } else {
195
- options.url += '&' + options.data;
196
- }
197
- }
198
- if (AcceptHeaders[options.dataType] == null) {
199
- options.dataType = '*';
200
- }
201
- options.accept = AcceptHeaders[options.dataType];
202
- if (options.dataType !== '*') {
203
- options.accept += ', */*; q=0.01';
204
- }
205
- return options;
206
- };
207
-
208
- createXHR = function(options, done) {
209
- var xhr;
210
- xhr = new XMLHttpRequest();
211
- xhr.open(options.type, options.url, true);
212
- xhr.setRequestHeader('Accept', options.accept);
213
- if (typeof options.data === 'string') {
214
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
215
- }
216
- if (!options.crossDomain) {
217
- xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
218
- }
219
- CSRFProtection(xhr);
220
- xhr.withCredentials = !!options.withCredentials;
221
- xhr.onreadystatechange = function() {
222
- if (xhr.readyState === XMLHttpRequest.DONE) {
223
- return done(xhr);
224
- }
225
- };
226
- return xhr;
227
- };
228
-
229
- processResponse = function(response, type) {
230
- var parser, script;
231
- if (typeof response === 'string' && typeof type === 'string') {
232
- if (type.match(/\bjson\b/)) {
233
- try {
234
- response = JSON.parse(response);
235
- } catch (undefined) {}
236
- } else if (type.match(/\bjavascript\b/)) {
237
- script = document.createElement('script');
238
- script.innerHTML = response;
239
- document.body.appendChild(script);
240
- } else if (type.match(/\b(xml|html|svg)\b/)) {
241
- parser = new DOMParser();
242
- type = type.replace(/;.+/, '');
243
- try {
244
- response = parser.parseFromString(response, type);
245
- } catch (undefined) {}
246
- }
247
- }
248
- return response;
249
- };
250
-
251
- Rails.href = function(element) {
252
- return element.href;
253
- };
254
-
255
- Rails.isCrossDomain = function(url) {
256
- var e, error, originAnchor, urlAnchor;
257
- originAnchor = document.createElement('a');
258
- originAnchor.href = location.href;
259
- urlAnchor = document.createElement('a');
260
- try {
261
- urlAnchor.href = url;
262
- return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || (originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host));
263
- } catch (error) {
264
- e = error;
265
- return true;
266
- }
267
- };
268
-
269
- }).call(this);
270
- (function() {
271
- var matches, toArray;
272
-
273
- matches = Rails.matches;
274
-
275
- toArray = function(e) {
276
- return Array.prototype.slice.call(e);
277
- };
278
-
279
- Rails.serializeElement = function(element, additionalParam) {
280
- var inputs, params;
281
- inputs = [element];
282
- if (matches(element, 'form')) {
283
- inputs = toArray(element.elements);
284
- }
285
- params = [];
286
- inputs.forEach(function(input) {
287
- if (!input.name) {
288
- return;
289
- }
290
- if (matches(input, 'select')) {
291
- return toArray(input.options).forEach(function(option) {
292
- if (option.selected) {
293
- return params.push({
294
- name: input.name,
295
- value: option.value
296
- });
297
- }
298
- });
299
- } else if (input.type !== 'radio' && input.type !== 'checkbox' || input.checked) {
300
- return params.push({
301
- name: input.name,
302
- value: input.value
303
- });
304
- }
305
- });
306
- if (additionalParam) {
307
- params.push(additionalParam);
308
- }
309
- return params.map(function(param) {
310
- if (param.name != null) {
311
- return (encodeURIComponent(param.name)) + "=" + (encodeURIComponent(param.value));
312
- } else {
313
- return param;
314
- }
315
- }).join('&');
316
- };
317
-
318
- Rails.formElements = function(form, selector) {
319
- if (matches(form, 'form')) {
320
- return toArray(form.elements).filter(function(el) {
321
- return matches(el, selector);
322
- });
323
- } else {
324
- return toArray(form.querySelectorAll(selector));
325
- }
326
- };
327
-
328
- Rails.blankInputs = function(form, selector, nonBlank) {
329
- var checkedRadioButtonNames, foundInputs, requiredInputs;
330
- foundInputs = [];
331
- requiredInputs = toArray(form.querySelectorAll(selector || 'input, textarea'));
332
- checkedRadioButtonNames = {};
333
- requiredInputs.forEach(function(input) {
334
- var radioName, radios, valueToCheck;
335
- if (input.type === 'radio') {
336
- radioName = input.name;
337
- if (!checkedRadioButtonNames[radioName]) {
338
- if (form.querySelectorAll("input[type=radio][name='" + radioName + "']:checked").length === 0) {
339
- radios = form.querySelectorAll("input[type=radio][name='" + radioName + "']");
340
- foundInputs = foundInputs.concat(toArray(radios));
341
- }
342
- return checkedRadioButtonNames[radioName] = radioName;
343
- }
344
- } else {
345
- valueToCheck = input.type === 'checkbox' ? input.checked : !!input.value;
346
- if (valueToCheck === nonBlank) {
347
- return foundInputs.push(input);
348
- }
349
- }
350
- });
351
- return foundInputs;
352
- };
353
-
354
- }).call(this);
355
- (function() {
356
- var allowAction, fire, stopEverything;
357
-
358
- fire = Rails.fire, stopEverything = Rails.stopEverything;
359
-
360
- Rails.handleConfirm = function(e) {
361
- if (!allowAction(this)) {
362
- return stopEverything(e);
363
- }
364
- };
365
-
366
- allowAction = function(element) {
367
- var answer, callback, message;
368
- message = element.getAttribute('data-confirm');
369
- if (!message) {
370
- return true;
371
- }
372
- answer = false;
373
- if (fire(element, 'confirm')) {
374
- try {
375
- answer = confirm(message);
376
- } catch (undefined) {}
377
- callback = fire(element, 'confirm:complete', [answer]);
378
- }
379
- return answer && callback;
380
- };
381
-
382
- }).call(this);
383
- (function() {
384
- var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, matches, setData, stopEverything;
385
-
386
- matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements;
387
-
388
- Rails.enableElement = function(e) {
389
- var element;
390
- element = e instanceof Event ? e.target : e;
391
- if (matches(element, Rails.linkDisableSelector)) {
392
- return enableLinkElement(element);
393
- } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {
394
- return enableFormElement(element);
395
- } else if (matches(element, Rails.formSubmitSelector)) {
396
- return enableFormElements(element);
397
- }
398
- };
399
-
400
- Rails.disableElement = function(e) {
401
- var element;
402
- element = e instanceof Event ? e.target : e;
403
- if (matches(element, Rails.linkDisableSelector)) {
404
- return disableLinkElement(element);
405
- } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {
406
- return disableFormElement(element);
407
- } else if (matches(element, Rails.formSubmitSelector)) {
408
- return disableFormElements(element);
409
- }
410
- };
411
-
412
- disableLinkElement = function(element) {
413
- var replacement;
414
- replacement = element.getAttribute('data-disable-with');
415
- if (replacement != null) {
416
- setData(element, 'ujs:enable-with', element.innerHTML);
417
- element.innerHTML = replacement;
418
- }
419
- element.addEventListener('click', stopEverything);
420
- return setData(element, 'ujs:disabled', true);
421
- };
422
-
423
- enableLinkElement = function(element) {
424
- var originalText;
425
- originalText = getData(element, 'ujs:enable-with');
426
- if (originalText != null) {
427
- element.innerHTML = originalText;
428
- setData(element, 'ujs:enable-with', null);
429
- }
430
- element.removeEventListener('click', stopEverything);
431
- return setData(element, 'ujs:disabled', null);
432
- };
433
-
434
- disableFormElements = function(form) {
435
- return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);
436
- };
437
-
438
- disableFormElement = function(element) {
439
- var replacement;
440
- replacement = element.getAttribute('data-disable-with');
441
- if (replacement != null) {
442
- if (matches(element, 'button')) {
443
- setData(element, 'ujs:enable-with', element.innerHTML);
444
- element.innerHTML = replacement;
445
- } else {
446
- setData(element, 'ujs:enable-with', element.value);
447
- element.value = replacement;
448
- }
449
- }
450
- element.disabled = true;
451
- return setData(element, 'ujs:disabled', true);
452
- };
453
-
454
- enableFormElements = function(form) {
455
- return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);
456
- };
457
-
458
- enableFormElement = function(element) {
459
- var originalText;
460
- originalText = getData(element, 'ujs:enable-with');
461
- if (originalText != null) {
462
- if (matches(element, 'button')) {
463
- element.innerHTML = originalText;
464
- } else {
465
- element.value = originalText;
466
- }
467
- setData(element, 'ujs:enable-with', null);
468
- }
469
- element.disabled = false;
470
- return setData(element, 'ujs:disabled', null);
471
- };
472
-
473
- }).call(this);
474
- (function() {
475
- var stopEverything;
476
-
477
- stopEverything = Rails.stopEverything;
478
-
479
- Rails.handleMethod = function(e) {
480
- var csrfParam, csrfToken, form, formContent, href, link, method;
481
- link = this;
482
- method = link.getAttribute('data-method');
483
- if (!method) {
484
- return;
485
- }
486
- href = Rails.href(link);
487
- csrfToken = Rails.csrfToken();
488
- csrfParam = Rails.csrfParam();
489
- form = document.createElement('form');
490
- formContent = "<input name='_method' value='" + method + "' type='hidden' />";
491
- if ((csrfParam != null) && (csrfToken != null) && !Rails.isCrossDomain(href)) {
492
- formContent += "<input name='" + csrfParam + "' value='" + csrfToken + "' type='hidden' />";
493
- }
494
- formContent += '<input type="submit" />';
495
- form.method = 'post';
496
- form.action = href;
497
- form.target = link.target;
498
- form.innerHTML = formContent;
499
- form.style.display = 'none';
500
- document.body.appendChild(form);
501
- form.querySelector('[type="submit"]').click();
502
- return stopEverything(e);
503
- };
504
-
505
- }).call(this);
506
- (function() {
507
- var ajax, blankInputs, fire, getData, isCrossDomain, isRemote, matches, serializeElement, setData, stopEverything,
508
- slice = [].slice;
509
-
510
- matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, blankInputs = Rails.blankInputs, serializeElement = Rails.serializeElement;
511
-
512
- isRemote = function(element) {
513
- var value;
514
- value = element.getAttribute('data-remote');
515
- return (value != null) && value !== 'false';
516
- };
517
-
518
- Rails.handleRemote = function(e) {
519
- var button, data, dataType, element, method, url, withCredentials;
520
- element = this;
521
- if (!isRemote(element)) {
522
- return true;
523
- }
524
- if (!fire(element, 'ajax:before')) {
525
- fire(element, 'ajax:stopped');
526
- return false;
527
- }
528
- withCredentials = element.getAttribute('data-with-credentials');
529
- dataType = element.getAttribute('data-type') || 'script';
530
- if (matches(element, Rails.formSubmitSelector)) {
531
- button = getData(element, 'ujs:submit-button');
532
- method = getData(element, 'ujs:submit-button-formmethod') || element.method;
533
- url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;
534
- if (method.toUpperCase() === 'GET') {
535
- url = url.replace(/\?.*$/, '');
536
- }
537
- if (element.enctype === 'multipart/form-data') {
538
- data = new FormData(element);
539
- if (button != null) {
540
- data.append(button.name, button.value);
541
- }
542
- } else {
543
- data = serializeElement(element, button);
544
- }
545
- setData(element, 'ujs:submit-button', null);
546
- setData(element, 'ujs:submit-button-formmethod', null);
547
- setData(element, 'ujs:submit-button-formaction', null);
548
- } else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {
549
- method = element.getAttribute('data-method');
550
- url = element.getAttribute('data-url');
551
- data = serializeElement(element, element.getAttribute('data-params'));
552
- } else {
553
- method = element.getAttribute('data-method');
554
- url = Rails.href(element);
555
- data = element.getAttribute('data-params');
556
- }
557
- ajax({
558
- type: method || 'GET',
559
- url: url,
560
- data: data,
561
- dataType: dataType,
562
- beforeSend: function(xhr, options) {
563
- if (fire(element, 'ajax:beforeSend', [xhr, options])) {
564
- return fire(element, 'ajax:send', [xhr]);
565
- } else {
566
- fire(element, 'ajax:stopped');
567
- return xhr.abort();
568
- }
569
- },
570
- success: function() {
571
- var args;
572
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
573
- return fire(element, 'ajax:success', args);
574
- },
575
- error: function() {
576
- var args;
577
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
578
- return fire(element, 'ajax:error', args);
579
- },
580
- complete: function() {
581
- var args;
582
- args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
583
- return fire(element, 'ajax:complete', args);
584
- },
585
- crossDomain: isCrossDomain(url),
586
- withCredentials: (withCredentials != null) && withCredentials !== 'false'
587
- });
588
- return stopEverything(e);
589
- };
590
-
591
- Rails.validateForm = function(e) {
592
- var blankRequiredInputs, form;
593
- form = this;
594
- if (form.noValidate || getData(form, 'ujs:formnovalidate-button')) {
595
- return;
596
- }
597
- blankRequiredInputs = blankInputs(form, Rails.requiredInputSelector, false);
598
- if (blankRequiredInputs.length > 0 && fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {
599
- return stopEverything(e);
600
- }
601
- };
602
-
603
- Rails.formSubmitButtonClick = function(e) {
604
- var button, form;
605
- button = this;
606
- form = button.form;
607
- if (!form) {
608
- return;
609
- }
610
- if (button.name) {
611
- setData(form, 'ujs:submit-button', {
612
- name: button.name,
613
- value: button.value
614
- });
615
- }
616
- setData(form, 'ujs:formnovalidate-button', button.formNoValidate);
617
- setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));
618
- return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));
619
- };
620
-
621
- Rails.handleMetaClick = function(e) {
622
- var data, link, metaClick, method;
623
- link = this;
624
- method = (link.getAttribute('data-method') || 'GET').toUpperCase();
625
- data = link.getAttribute('data-params');
626
- metaClick = e.metaKey || e.ctrlKey;
627
- if (metaClick && method === 'GET' && !data) {
628
- return e.stopImmediatePropagation();
629
- }
630
- };
631
-
632
- }).call(this);
633
- (function() {
634
- var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleMetaClick, handleMethod, handleRemote, refreshCSRFTokens, validateForm;
635
-
636
- fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleConfirm = Rails.handleConfirm, handleRemote = Rails.handleRemote, validateForm = Rails.validateForm, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMetaClick = Rails.handleMetaClick, handleMethod = Rails.handleMethod;
637
-
638
- if ((typeof jQuery !== "undefined" && jQuery !== null) && !jQuery.rails) {
639
- jQuery.rails = Rails;
640
- jQuery.ajaxPrefilter(function(options, originalOptions, xhr) {
641
- if (!options.crossDomain) {
642
- return CSRFProtection(xhr);
643
- }
644
- });
645
- }
646
-
647
- Rails.start = function() {
648
- if (window._rails_loaded) {
649
- throw new Error('jquery-ujs has already been loaded!');
650
- }
651
- window.addEventListener('pageshow', function() {
652
- $(Rails.formEnableSelector).forEach(function(el) {
653
- if (getData(el, 'ujs:disabled')) {
654
- return enableElement(el);
655
- }
656
- });
657
- return $(Rails.linkDisableSelector).forEach(function(el) {
658
- if (getData(el, 'ujs:disabled')) {
659
- return enableElement(el);
660
- }
661
- });
662
- });
663
- delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);
664
- delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);
665
- delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);
666
- delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);
667
- delegate(document, Rails.linkClickSelector, 'click', handleConfirm);
668
- delegate(document, Rails.linkClickSelector, 'click', handleMetaClick);
669
- delegate(document, Rails.linkClickSelector, 'click', disableElement);
670
- delegate(document, Rails.linkClickSelector, 'click', handleRemote);
671
- delegate(document, Rails.linkClickSelector, 'click', handleMethod);
672
- delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);
673
- delegate(document, Rails.buttonClickSelector, 'click', disableElement);
674
- delegate(document, Rails.buttonClickSelector, 'click', handleRemote);
675
- delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);
676
- delegate(document, Rails.inputChangeSelector, 'change', handleRemote);
677
- delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);
678
- delegate(document, Rails.formSubmitSelector, 'submit', validateForm);
679
- delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);
680
- delegate(document, Rails.formSubmitSelector, 'submit', function(e) {
681
- return setTimeout((function() {
682
- return disableElement(e);
683
- }), 13);
684
- });
685
- delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);
686
- delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);
687
- delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);
688
- delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);
689
- document.addEventListener('DOMContentLoaded', refreshCSRFTokens);
690
- return window._rails_loaded = true;
691
- };
692
-
693
- if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {
694
- Rails.start();
695
- }
696
-
697
- }).call(this);
698
- }).call(this);
699
-
700
- if (typeof module === "object" && module.exports) {
701
- module.exports = Rails;
702
- } else if (typeof define === "function" && define.amd) {
703
- define(Rails);
704
- }
705
- }).call(this);
@@ -1,15 +0,0 @@
1
- <div class="split-pane-left-content">
2
- <% if @users.blank? %>
3
- <p class="split-pane-left-content-empty">No users found for your search.</p>
4
- <% else %>
5
- <% @users.each do |user| %>
6
- <div class="split-pane-item" data-url="<%= admin_user_path(user) %>" data-id="<%= user.id %>">
7
- <span class="split-pane-item-title"><%= user.full_name %></span>
8
- <span class="split-pane-item-meta"><%= user.email %></span>
9
- </div>
10
- <% end %>
11
- <% end %>
12
- </div>
13
- <div class="split-pane-left-pagination">
14
- <%= will_paginate @users %>
15
- </div>