muck-contents 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.5
1
+ 0.2.6
@@ -24,5 +24,17 @@ module TinymceHelper
24
24
  def tiny_mce_upload_form(parent)
25
25
  upload_form(parent, true, '', :upload_url =>new_upload_path_with_session_information(parent, 'json'))
26
26
  end
27
-
27
+
28
+ # Renders script required for a single tinymce editor on a page. This script will enable
29
+ # the save button in the editor and include tinymce scripts if needed.
30
+ # If the page contains multiple editors call this method one time for each editor
31
+ # passing in the id.
32
+ # form_id: id of form containing editor.
33
+ # mce_id: id of tiny mce editor
34
+ # message_container_id: id of a container for returned messages
35
+ # message_id: id of the container for the actual message
36
+ def tiny_mce_scripts(options = {})
37
+ render :partial => 'tiny_mce/tiny_mce_scripts', :locals => options
38
+ end
39
+
28
40
  end
@@ -27,42 +27,4 @@ message_id = "#{content.dom_id}_message"
27
27
  <% end %>
28
28
  </div>
29
29
 
30
- <% content_for :head do -%>
31
- <%= include_tiny_mce_if_needed %>
32
- <% end -%>
33
-
34
- <script language="javascript" type="text/javascript">
35
- function save_page() {
36
- tinyMCE.triggerSave(true,true);
37
- var form = jQuery('#<%= form_id %>');
38
- jQuery('#errorExplanation').fadeOut();
39
- jQuery.post(form.attr('action') + '.json', form.serialize(),
40
- function(data){
41
- var json = eval('(' + data + ')');
42
- if(json.success){
43
- undirty();
44
- if(json.type == 'create'){
45
- jQuery('#<%= form_id %>').attr('action', json.update_path);
46
- jQuery('#<%= form_id %>').append('<input id="hidden_put" type="hidden" value="put" name="_method"/>');
47
- jQuery('#preview').attr('href', json.preview_path);
48
- jQuery('#preview').show();
49
- }
50
- } else {
51
- show_message(json.message);
52
- }
53
- });
54
- return false;
55
- }
56
- function show_message(message){
57
- <% if GlobalConfig.growl_enabled -%>
58
- jQuery.jGrowl.info(message);
59
- <% else -%>
60
- jQuery('#<%=message_container_id%>').show();
61
- jQuery('#<%=message_id%>').fadeIn();
62
- <% end -%>
63
- }
64
- function undirty(){
65
- var ed = tinyMCE.get('<%=mce_id%>');
66
- ed.isNotDirty = 1;
67
- }
68
- </script>
30
+ <%= tiny_mce_scripts(:form_id => form_id, :mce_id => mce_id, :message_container_id => message_container_id, :message_id => message_id) -%>
@@ -0,0 +1,39 @@
1
+ <% content_for :head do -%>
2
+ <%= include_tiny_mce_if_needed %>
3
+ <% end -%>
4
+
5
+ <script language="javascript" type="text/javascript">
6
+ function save_page() {
7
+ tinyMCE.triggerSave(true,true);
8
+ var form = jQuery('#<%= form_id %>');
9
+ jQuery('#errorExplanation').fadeOut();
10
+ jQuery.post(form.attr('action') + '.json', form.serialize(),
11
+ function(data){
12
+ var json = eval('(' + data + ')');
13
+ if(json.success){
14
+ undirty();
15
+ if(json.type == 'create'){
16
+ jQuery('#<%= form_id %>').attr('action', json.update_path);
17
+ jQuery('#<%= form_id %>').append('<input id="hidden_put" type="hidden" value="put" name="_method"/>');
18
+ jQuery('#preview').attr('href', json.preview_path);
19
+ jQuery('#preview').show();
20
+ }
21
+ } else {
22
+ show_message(json.message);
23
+ }
24
+ });
25
+ return false;
26
+ }
27
+ function show_message(message){
28
+ <% if GlobalConfig.growl_enabled -%>
29
+ jQuery.jGrowl.info(message);
30
+ <% else -%>
31
+ jQuery('#<%=message_container_id%>').show();
32
+ jQuery('#<%=message_id%>').fadeIn();
33
+ <% end -%>
34
+ }
35
+ function undirty(){
36
+ var ed = tinyMCE.get('<%=mce_id%>');
37
+ ed.isNotDirty = 1;
38
+ }
39
+ </script>
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muck-contents}
8
- s.version = "0.2.5"
8
+ s.version = "0.2.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Ball", "Joel Duffin"]
12
- s.date = %q{2009-11-17}
12
+ s.date = %q{2009-11-19}
13
13
  s.email = %q{justin@tatemae.com}
14
14
  s.extra_rdoc_files = [
15
15
  "README.rdoc"
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "app/views/contents/new.html.erb",
34
34
  "app/views/contents/show.html.erb",
35
35
  "app/views/layouts/tiny_mce.html.erb",
36
+ "app/views/tiny_mce/_tiny_mce_scripts.html.erb",
36
37
  "app/views/tiny_mce/files.html.erb",
37
38
  "app/views/tiny_mce/images.html.erb",
38
39
  "app/views/tiny_mce/links.html.erb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muck-contents
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Ball
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-17 00:00:00 -07:00
13
+ date: 2009-11-19 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -130,6 +130,7 @@ files:
130
130
  - app/views/contents/new.html.erb
131
131
  - app/views/contents/show.html.erb
132
132
  - app/views/layouts/tiny_mce.html.erb
133
+ - app/views/tiny_mce/_tiny_mce_scripts.html.erb
133
134
  - app/views/tiny_mce/files.html.erb
134
135
  - app/views/tiny_mce/images.html.erb
135
136
  - app/views/tiny_mce/links.html.erb