tb_core 0.9.18 → 0.9.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzU2Mzg1MWRiNGM0YTY2NjA0MDEwZDNhMzQ3NjY1OWViMWYwYzc4OA==
4
+ ZGUxM2I3ZjAyNmY2OTRhNGUyNThjNjFlYmYxZmNjNjQxYmVmNmZjNQ==
5
5
  data.tar.gz: !binary |-
6
- MzRkY2M5NjY0MTAzMGZlOTI1MTlhMDMxMmJlMDc0YTgxZWM1MWFmZQ==
6
+ ZGRhYTU0OGExYWFkNjI2ZDNiOThiN2RmMWYwNGM4NmMwNTllOTYwZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZDc2ZDNjOTcyNzU1YTU0NDI5YzZlZGI2NzRjOTAzMDljYzI1ZWEwYTRkODM0
10
- YmQyNzRjOTRmZGNiZTY5Mjc0ZDI3OTY0OTMyZWM4MDEzMTIxMjJmMjgzZDVi
11
- OTY3MTk1ZWMzYzczOTllNTEwNDZlMmQ0Yzg1YmE1MWRkNjk2ZTk=
9
+ ZTNmNGZjMzFmNTk1ZThmZmRjZGFjNDVlYTViNzJjYTYwZTFiZjE3MWE2NWMy
10
+ OWQ3ZDhiNjY0MWFmYzM5YWE4YzBjNDZiYWMxNzhjNDA3ZGQ3NGZlZWZhM2Nm
11
+ OWVjZDFkNzM2NTlhODdmMzk0YmE4OGEyOGU2M2VmNWU2NTdhNTU=
12
12
  data.tar.gz: !binary |-
13
- MjQ2Y2FiYzhlMGEzOGJhZGFiZGM4MDY3YTJjYzViM2MwOTM4ZjlhNmQ2ZTMz
14
- OWQ1NDdhZWFmMDFhYWI4MmVhNTYwZDgyZDI0NDRjOWQ5YzZmNzAyNDVlZTQw
15
- ZDBmYjdjZjBkY2JhNjAyM2U3NjI3OGMxNjdhM2Y5Yjg1OGE4NzU=
13
+ OGFiNDQzNzBiZmI0NDlmZTcyMDk2OTlmZjAyNDg4NTMyNjU4OWM3ZGIxNTBm
14
+ NDg2YmZhYTI1NWQ5ZDI4OWU0NjVhYjRmZjQ5MWQxM2QzNTIwM2E0YTJhNmE3
15
+ NmM2OGQzOGQwMzViOWM3MmZiZDNlOGZkODhkMmI3MDgxMDgwNTE=
@@ -18,6 +18,7 @@ spud.admin.editor = {};
18
18
  []
19
19
  ];
20
20
 
21
+
21
22
  var validElements = "@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|" +
22
23
  "onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|" +
23
24
  "onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|" +
@@ -44,7 +45,6 @@ spud.admin.editor = {};
44
45
 
45
46
  var validFormats = "p,h1,h2,h3,h4,h5,h6";
46
47
 
47
-
48
48
  editor.init = function(options) {
49
49
  editor.monitorFormatters();
50
50
  options = options || {};
@@ -59,9 +59,7 @@ spud.admin.editor = {};
59
59
  case 'HTML':
60
60
  default:
61
61
  editor.initMCEWithOptions(this, options || {});
62
- };
63
-
64
-
62
+ }
65
63
  });
66
64
 
67
65
  };
@@ -82,37 +80,47 @@ spud.admin.editor = {};
82
80
 
83
81
  var theme = options.theme || 'advanced';
84
82
  var height = options.height || 400;
83
+ var width = options.width || $(element).width();
84
+
85
+ var buttons = [];
86
+ if(options.buttons){
87
+ for(var i=0; i<4; i++){
88
+ var row = options.buttons[i] || [];
89
+ buttons.push(row);
90
+ }
91
+ }
92
+ else{
93
+ buttons = registeredButtons;
94
+ }
85
95
 
86
96
  $(element).tinymce({
87
- theme: theme,
88
- plugins: registeredPlugins.join(','),
89
- theme_advanced_toolbar_location: "top",
90
- theme_advanced_buttons1: registeredButtons[0].join(','),
91
- theme_advanced_buttons2: registeredButtons[1].join(','),
92
- theme_advanced_buttons3: registeredButtons[2].join(','),
93
- theme_advanced_buttons4: registeredButtons[3].join(','),
94
- theme_advanced_toolbar_align: 'left',
95
- theme_advanced_blockformats: validFormats,
96
- convert_urls: false,
97
- valid_elements: validElements,
98
- media_strict: false,
99
- extended_valid_elements: extendedValidElements.join(","),
100
- width: $(element).width(),
101
- height: height
97
+ theme: theme,
98
+ plugins: registeredPlugins.join(','),
99
+ theme_advanced_toolbar_location: "top",
100
+ theme_advanced_buttons1: buttons[0].join(','),
101
+ theme_advanced_buttons2: buttons[1].join(','),
102
+ theme_advanced_buttons3: buttons[2].join(','),
103
+ theme_advanced_buttons4: buttons[3].join(','),
104
+ theme_advanced_toolbar_align: 'left',
105
+ theme_advanced_blockformats: validFormats,
106
+ convert_urls: false,
107
+ valid_elements: validElements,
108
+ media_strict: false,
109
+ extended_valid_elements: extendedValidElements.join(","),
110
+ width: width,
111
+ height: height
102
112
  });
103
-
104
-
105
113
  };
106
114
 
107
115
  var codeMirrors = [];
108
116
  editor.initCodeMirrorWithOptions = function(element, format, options) {
109
117
  var editor = CodeMirror.fromTextArea(element, {
110
- mode: 'markdown',
111
- lineNumbers: true,
112
- lineWrapping: true,
113
- theme: "default",
114
- extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}
115
- });
118
+ mode: 'markdown',
119
+ lineNumbers: true,
120
+ lineWrapping: true,
121
+ theme: "default",
122
+ extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}
123
+ });
116
124
  codeMirrors.push(editor);
117
125
 
118
126
  $(element).attr('code-mirror-id',codeMirrors.length-1);
@@ -132,8 +140,6 @@ spud.admin.editor = {};
132
140
 
133
141
  };
134
142
 
135
-
136
-
137
143
  editor.registerPlugin = function(pluginName){
138
144
  if($.inArray(registeredPlugins, pluginName) < 0){
139
145
  registeredPlugins.push(pluginName);
@@ -246,7 +246,7 @@ div.field_with_errors {
246
246
  }
247
247
  div.field_with_errors label {
248
248
  color:#F00;
249
- background: url(/images/icons/error.png) top left no-repeat;
249
+ /*background: url(/images/icons/error.png) top left no-repeat;*/
250
250
  }
251
251
 
252
252
 
@@ -103,6 +103,6 @@ div.field_with_errors {
103
103
  }
104
104
  div.field_with_errors label {
105
105
  color:#F00;
106
- background: url(/images/icons/error.png) top left no-repeat;
106
+ /*background: url(/images/icons/error.png) top left no-repeat;*/
107
107
  }
108
108
  .formtab_buttons li {}
@@ -0,0 +1,69 @@
1
+ # Copyright (c) 2006 Sean Treadway
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+
23
+ # Module containing the methods useful for child IFRAME to parent window communication
24
+ module RespondsToParent
25
+
26
+ # Executes the response body as JavaScript in the context of the parent window.
27
+ # Use this method of you are posting a form to a hidden IFRAME or if you would like
28
+ # to use IFRAME base RPC.
29
+ def responds_to_parent(&block)
30
+ yield
31
+
32
+ if performed?
33
+ # We're returning HTML instead of JS or XML now
34
+ response.headers['Content-Type'] = 'text/html; charset=UTF-8'
35
+
36
+ # Either pull out a redirect or the request body
37
+ script = if response.headers['Location']
38
+ #TODO: erase_redirect_results is missing in rails 3.0 has to be implemented
39
+ # erase redirect
40
+ "document.location.href = #{location.to_s.inspect}"
41
+ else
42
+ response.body
43
+ end
44
+
45
+ # Escape quotes, linebreaks and slashes, maintaining previously escaped slashes
46
+ # Suggestions for improvement?
47
+ script = (script || '').
48
+ gsub('\\', '\\\\\\').
49
+ gsub(/\r\n|\r|\n/, '\\n').
50
+ gsub(/['"]/, '\\\\\&').
51
+ gsub('</script>','</scr"+"ipt>')
52
+
53
+ # Clear out the previous render to prevent double render
54
+ response.request.env['action_controller.instance'].instance_variable_set(:@_response_body, nil)
55
+
56
+ # Eval in parent scope and replace document location of this frame
57
+ # so back button doesn't replay action on targeted forms
58
+ # loc = document.location to be set after parent is updated for IE
59
+ # with(window.parent) - pull in variables from parent window
60
+ # setTimeout - scope the execution in the windows parent for safari
61
+ # window.eval - legal eval for Opera
62
+ render :text => "<html><body><script type='text/javascript' charset='utf-8'>
63
+ var loc = document.location;
64
+ with(window.parent) { setTimeout(function() { window.eval('#{script}'); if (typeof(loc) !== 'undefined') loc.replace('about:blank'); }, 1) };
65
+ </script></body></html>".html_safe
66
+ end
67
+ end
68
+ alias respond_to_parent responds_to_parent
69
+ end
@@ -15,6 +15,7 @@ module Spud
15
15
  class Engine < ::Rails::Engine
16
16
  require "#{root}/lib/spud_core/belongs_to_app"
17
17
  require "#{root}/lib/spud_core/searchable"
18
+ require "#{root}/lib/responds_to_parent"
18
19
 
19
20
  def self.require_model(model_name)
20
21
  require "#{root}/app/models/#{model_name}"
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Core
3
- VERSION = "0.9.18"
3
+ VERSION = "0.9.19"
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: 0.9.18
4
+ version: 0.9.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Woods
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-13 00:00:00.000000000 Z
11
+ date: 2013-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -489,6 +489,7 @@ files:
489
489
  - db/migrate/20120327124229_add_time_zone_to_spud_user.rb
490
490
  - db/migrate/20120328235431_add_scope_to_spud_admin_permissions.rb
491
491
  - db/migrate/20120329174000_create_spud_user_settings.rb
492
+ - lib/responds_to_parent.rb
492
493
  - lib/spud_core/belongs_to_app.rb
493
494
  - lib/spud_core/configuration.rb
494
495
  - lib/spud_core/engine.rb