tb_core 1.2.2 → 1.2.3
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/images/admin/module_icon.png +0 -0
- data/app/assets/javascripts/admin/core/application.js +26 -97
- data/app/assets/javascripts/admin/core/dashboard.js +14 -7
- data/app/assets/javascripts/admin/core/modal.js +47 -0
- data/app/controllers/spud/application_controller.rb +4 -4
- data/app/helpers/admin/application_helper.rb +0 -12
- data/app/models/spud/spud_user_model.rb +13 -0
- data/lib/spud_core/engine.rb +0 -1
- data/lib/spud_core/version.rb +1 -1
- metadata +3 -17
- data/app/assets/images/admin/module_icon@2x.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f90c1e3395d45e3a5e48b296d5176c88dd3701ab
|
4
|
+
data.tar.gz: 6425455e234a5ccadc3fcc38f668578de9ba90c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce5ec2edd76b476e08e23d2b2129bdae35b285a448ca372c490dc09efdc7043b5779f5f94054775079f0c0b93fd23ab96777ae2938cdb8f97b7e39ebf9b60f8b
|
7
|
+
data.tar.gz: 77e0e1dd611e1d6d9e44fadb0b234d86787dba522c993a390f81e0d03319a9d042fd7d78ad3a1fbeb8d1fb923cc7f8cf6f43bd34b7ce085f4102eb16f087fc32
|
Binary file
|
@@ -1,6 +1,5 @@
|
|
1
1
|
//= require jquery
|
2
2
|
//= require jquery_ujs
|
3
|
-
//= require admin/core/preinit
|
4
3
|
//= require tinymce-jquery
|
5
4
|
//= require tinymce/plugins/tableDropdown/editor_plugin
|
6
5
|
//= require bootstrap/js/bootstrap
|
@@ -9,7 +8,6 @@
|
|
9
8
|
//= require ../../tb_core
|
10
9
|
//= require_self
|
11
10
|
//= require_tree .
|
12
|
-
//= require retina_tag
|
13
11
|
|
14
12
|
spud = {admin:{}};
|
15
13
|
|
@@ -17,104 +15,35 @@ $(document).ready(function() {
|
|
17
15
|
|
18
16
|
spud.admin.editor.init();
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
});
|
40
|
-
|
41
|
-
// dialog.load(url + ".js",
|
42
|
-
// function(responseText, textStatus, XMLHttpRequest) {
|
43
|
-
// dialog.dialog({width:500,modal:true,height:500,title:title});
|
44
|
-
// });
|
45
|
-
return false;
|
18
|
+
$("#modal_window .modal-footer .form-submit").bind('click', function() {
|
19
|
+
$("#modal_window .modal-body form").submit();
|
20
|
+
});
|
21
|
+
|
22
|
+
$("#modal_window ").on('hidden', function(){
|
23
|
+
$(this).find('.modal-footer-additional').remove();
|
24
|
+
$(this).find('.modal-footer-default').show();
|
25
|
+
$(this).removeData('modal');
|
26
|
+
});
|
27
|
+
|
28
|
+
$('body').on('click', 'a.ajax', function() {
|
29
|
+
var url = this.href;
|
30
|
+
var title = this.title;
|
31
|
+
var dialog = $("#modal_window");
|
32
|
+
|
33
|
+
$("#modal_window .modal-title").text(title);
|
34
|
+
dialog.modal({
|
35
|
+
remote: url +".js",
|
36
|
+
show:true
|
46
37
|
});
|
47
38
|
|
39
|
+
return false;
|
40
|
+
});
|
48
41
|
|
49
|
-
|
50
|
-
function(data, textStatus, jqXHR){
|
51
|
-
$(this).closest('tr').fadeOut();
|
52
|
-
});
|
53
|
-
|
54
|
-
|
55
|
-
$('a.button').button();
|
42
|
+
$('a.button').button();
|
56
43
|
|
44
|
+
$('input[type=submit].btn').click(function() {$(this).button('loading');});
|
57
45
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
$(this).parent().submit();
|
62
|
-
});
|
63
|
-
|
46
|
+
$('#multisite_switcher select').change(function() {
|
47
|
+
$(this).parent().submit();
|
48
|
+
});
|
64
49
|
} );
|
65
|
-
|
66
|
-
|
67
|
-
function remove_fields(link) {
|
68
|
-
$(link).prev("input[type=hidden]").val("1");
|
69
|
-
$(link).closest(".fields").hide();
|
70
|
-
}
|
71
|
-
|
72
|
-
function add_fields(link, association, content) {
|
73
|
-
var new_id = new Date().getTime();
|
74
|
-
var regexp = new RegExp("new_" + association, "g")
|
75
|
-
$(link).parent().before(content.replace(regexp, new_id));
|
76
|
-
}
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
function initTinyMCE(selector) {
|
82
|
-
console.warn('Deprecation Notice: `initTinyMCE()` is deprecated, please use `spud.admin.editor.init()` instead.');
|
83
|
-
spud.admin.editor.init();
|
84
|
-
}
|
85
|
-
|
86
|
-
function initDatePicker(selector){
|
87
|
-
console.warn('Deprecation Notice: `initDatePicker()` is deprecated, please use `spud.admin.date_picker.init()` instead.');
|
88
|
-
spud.admin.date_picker.init();
|
89
|
-
|
90
|
-
}
|
91
|
-
|
92
|
-
function displayModalDialogWithOptions(options){
|
93
|
-
var modal = $('#modal_window');
|
94
|
-
if(options.title){
|
95
|
-
modal.find('.modal-title').text(options.title);
|
96
|
-
}
|
97
|
-
if(options.html){
|
98
|
-
modal.find('.modal-body').html(options.html);
|
99
|
-
}
|
100
|
-
var defaultFooter = modal.find('.modal-footer-default');
|
101
|
-
if(options.buttons){
|
102
|
-
var newFooter = defaultFooter.clone();
|
103
|
-
newFooter.addClass('modal-footer-additional');
|
104
|
-
newFooter.find('.form-submit').remove();
|
105
|
-
for(var key in options.buttons){
|
106
|
-
newFooter.append('<button class="btn '+key+'">'+options.buttons[key]+'</button>');
|
107
|
-
}
|
108
|
-
defaultFooter.hide();
|
109
|
-
modal.append(newFooter);
|
110
|
-
}
|
111
|
-
else{
|
112
|
-
defaultFooter.show();
|
113
|
-
}
|
114
|
-
modal.modal('show');
|
115
|
-
}
|
116
|
-
|
117
|
-
function hideModalDialog(){
|
118
|
-
var modal = $('#modal_window');
|
119
|
-
modal.modal('hide');
|
120
|
-
}
|
@@ -1,27 +1,34 @@
|
|
1
1
|
(function(){
|
2
2
|
|
3
|
+
var badgeInterval;
|
4
|
+
|
3
5
|
spud.admin.dashboard = {
|
4
6
|
init:function(){
|
7
|
+
badgeInterval = setInterval(updateBadges, 30000);
|
5
8
|
updateBadges();
|
6
|
-
setInterval(updateBadges, 30000);
|
7
9
|
}
|
8
10
|
};
|
9
11
|
|
10
|
-
var updateBadges = function
|
12
|
+
var updateBadges = function() {
|
11
13
|
var url = tb.util.urlFor('admin/badges');
|
12
14
|
$.ajax({
|
13
15
|
url: url
|
14
16
|
}).always(function(json) {
|
15
17
|
if(json && json.data) {
|
16
|
-
json.data.
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
if(json.data.length === 0){
|
19
|
+
clearInterval(badgeInterval);
|
20
|
+
}
|
21
|
+
else{
|
22
|
+
json.data.forEach(function(eachBadge) {
|
23
|
+
var id = "application_name_" + eachBadge.key;
|
24
|
+
updateBadge(id, eachBadge.badge_count);
|
25
|
+
});
|
26
|
+
}
|
20
27
|
}
|
21
28
|
});
|
22
29
|
};
|
23
30
|
|
24
|
-
var updateBadge = function
|
31
|
+
var updateBadge = function(badge_id, count) {
|
25
32
|
var badgeIcon = $('#' + badge_id).find('.dash_icon_badge');
|
26
33
|
if(badgeIcon.length === 0) {
|
27
34
|
return;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
(function(){
|
2
|
+
|
3
|
+
spud.admin.modal = {
|
4
|
+
|
5
|
+
displayWithOptions: function(options){
|
6
|
+
var modal = $('#modal_window');
|
7
|
+
if(options.title){
|
8
|
+
modal.find('.modal-title').text(options.title);
|
9
|
+
}
|
10
|
+
if(options.html){
|
11
|
+
modal.find('.modal-body').html(options.html);
|
12
|
+
}
|
13
|
+
var defaultFooter = modal.find('.modal-footer-default');
|
14
|
+
if(options.buttons){
|
15
|
+
var newFooter = defaultFooter.clone();
|
16
|
+
newFooter.addClass('modal-footer-additional');
|
17
|
+
newFooter.find('.form-submit').remove();
|
18
|
+
for(var key in options.buttons){
|
19
|
+
newFooter.append('<button class="btn '+key+'">'+options.buttons[key]+'</button>');
|
20
|
+
}
|
21
|
+
defaultFooter.hide();
|
22
|
+
modal.append(newFooter);
|
23
|
+
}
|
24
|
+
else{
|
25
|
+
defaultFooter.show();
|
26
|
+
}
|
27
|
+
modal.modal('show');
|
28
|
+
},
|
29
|
+
|
30
|
+
hide: function(){
|
31
|
+
var modal = $('#modal_window');
|
32
|
+
modal.modal('hide');
|
33
|
+
}
|
34
|
+
|
35
|
+
};
|
36
|
+
|
37
|
+
})();
|
38
|
+
|
39
|
+
function displayModalDialogWithOptions(options){
|
40
|
+
console.warn('displayModalDialogWithOptions() is deprecated, please use spud.admin.modal.displayWithOptions.');
|
41
|
+
spud.admin.modal.displayWithOptions(options);
|
42
|
+
}
|
43
|
+
|
44
|
+
function hideModalDialog(){
|
45
|
+
console.warn('hideModalDialog() is deprecated, please use spud.admin.modal.hide');
|
46
|
+
spud.admin.modal.hide();
|
47
|
+
}
|
@@ -91,12 +91,12 @@ private
|
|
91
91
|
@exception = exception
|
92
92
|
@exception.request_url = request.original_url
|
93
93
|
respond_to do |format|
|
94
|
-
format.html{
|
95
|
-
template = @exception.template || Spud::Core.not_found_template
|
96
|
-
render :template => template, :layout => nil, :formats => [:html], :status => 404
|
97
|
-
}
|
98
94
|
format.json{ render :json => {:errors => "The #{@exception.item} you were looking for could not be found."}, :status => 404 }
|
99
95
|
format.xml{ render :xml => {:errors => "The #{@exception.item} you were looking for could not be found."}, :status => 404 }
|
96
|
+
format.all{
|
97
|
+
template = @exception.template || Spud::Core.not_found_template
|
98
|
+
render :template => template, :layout => nil, :formats => [:html], :status => 404, :content_type => 'text/html'
|
99
|
+
}
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
@@ -23,18 +23,6 @@ module Admin::ApplicationHelper
|
|
23
23
|
return style_str
|
24
24
|
end
|
25
25
|
|
26
|
-
def link_to_remove_fields(name, f)
|
27
|
-
f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)",:class => "btn btn-danger")
|
28
|
-
end
|
29
|
-
|
30
|
-
def link_to_add_fields(name, f, association)
|
31
|
-
new_object = f.object.class.reflect_on_association(association).klass.new
|
32
|
-
fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
|
33
|
-
render(association.to_s.singularize + "_fields", :f => builder)
|
34
|
-
end
|
35
|
-
link_to_function(name, "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")",:class =>"btn")
|
36
|
-
end
|
37
|
-
|
38
26
|
def error_messages_for(object)
|
39
27
|
content = ""
|
40
28
|
if object.errors.any?
|
@@ -80,4 +80,17 @@ class Spud::SpudUserModel < ActiveRecord::Base
|
|
80
80
|
return self.where('login like ? or concat(`first_name`, " ", `last_name`) like ?', like, like)
|
81
81
|
end
|
82
82
|
|
83
|
+
# Return an array of users who have the requested permission
|
84
|
+
#
|
85
|
+
# * tag - Desired permission tag string (required)
|
86
|
+
# * include_supers - Whether to include super user (default: true)
|
87
|
+
def self.with_permission(tag, include_supers:true)
|
88
|
+
role_ids = SpudRolePermission.where(:spud_permission_tag => tag).pluck(:spud_role_id).uniq()
|
89
|
+
if include_supers
|
90
|
+
return SpudUser.where('super_admin = 1 OR spud_role_id IN (?)', role_ids)
|
91
|
+
else
|
92
|
+
return SpudUser.where(:spud_role_id => role_ids)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
83
96
|
end
|
data/lib/spud_core/engine.rb
CHANGED
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.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: 2014-
|
11
|
+
date: 2014-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: retina_tag
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: codemirror-rails
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -316,7 +302,6 @@ files:
|
|
316
302
|
- Rakefile
|
317
303
|
- app/assets/images/admin/down_arrow.gif
|
318
304
|
- app/assets/images/admin/module_icon.png
|
319
|
-
- app/assets/images/admin/module_icon@2x.png
|
320
305
|
- app/assets/images/admin/up_arrow.gif
|
321
306
|
- app/assets/images/admin/users_thumb.png
|
322
307
|
- app/assets/javascripts/admin/application.js
|
@@ -324,6 +309,7 @@ files:
|
|
324
309
|
- app/assets/javascripts/admin/core/dashboard.js
|
325
310
|
- app/assets/javascripts/admin/core/date_picker.js
|
326
311
|
- app/assets/javascripts/admin/core/editor.js
|
312
|
+
- app/assets/javascripts/admin/core/modal.js
|
327
313
|
- app/assets/javascripts/admin/core/preinit.js
|
328
314
|
- app/assets/javascripts/admin/core/roles.js
|
329
315
|
- app/assets/javascripts/admin/core/split_pane.js
|
Binary file
|