noodall-ui 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -6,8 +6,10 @@ doc/app
6
6
  rerun.txt
7
7
  .sass-cache
8
8
  .bundle
9
+ .rvmrc
9
10
  Gemfile.lock
10
11
 
12
+
11
13
  ## MAC OS
12
14
  .DS_Store
13
15
 
@@ -1,5 +1,5 @@
1
1
  module Noodall
2
2
  module UI
3
- VERSION = "0.3.6"
3
+ VERSION = "0.3.7"
4
4
  end
5
5
  end
@@ -8,7 +8,7 @@ lite_tiny_mce_config = {
8
8
  editor_selector : "lite-editor",
9
9
  strict_loading_mode : 1,
10
10
  convert_urls : false,
11
- plugins : "safari,inlinepopups,xhtmlxtras,paste,media,advimage,table,media,addvideo",
11
+ plugins : "safari,inlinepopups,xhtmlxtras,paste,media,advimage,table,addvideo",
12
12
  //"safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking",
13
13
  // Theme options
14
14
  theme_advanced_blockformats : "h2,h3,h4,p",
@@ -50,6 +50,7 @@ $.extend(tiny_mce_config, lite_tiny_mce_config, {
50
50
  Browser.action = function(e) {
51
51
  e.stopImmediatePropagation();
52
52
  asset_id = Browser.assets_to_add[0]
53
+
53
54
  if (asset_id) {
54
55
  add_url = $('#asset-' + asset_id).siblings('a.show').attr('href').split('?')[0] + '/add';
55
56
  $.get(add_url, { node_id: NoodallNode.id() }, function(data) {
@@ -101,15 +102,6 @@ $.extend(tiny_mce_config, lite_tiny_mce_config, {
101
102
 
102
103
 
103
104
 
104
- // Adding Videos
105
- ed.addButton('addvideo', {
106
- title : 'Add a youtube Video',
107
- image : '/images/admin/youtube.gif',
108
- href: '#',
109
- onclick : function() {
110
- alert("hi");
111
- }
112
- });
113
105
 
114
106
  ed.onPostProcess.add(function(ed, o) {
115
107
  if(o.save){
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <title>Add a Youtube video</title>
5
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
+ <script type="text/javascript" src="js/addvideo.js"></script>
7
+ </head>
8
+ <body>
9
+ <form onsubmit="AddvideoDialog.insert();return false;" action="#">
10
+ <p>Please enter the details of the youtube video</p>
11
+ <p>Video Title: <input id="videotitle" name="videotitle" type="text" class="text" /></p>
12
+ <p>Video URL: <input id="videourl" name="videourl" type="text" class="text" /></p>
13
+ <div class="mceActionPanel">
14
+ <input type="button" id="insert" name="insert" value="{#insert}" onclick="AddvideoDialog.insert();" />
15
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
16
+ </div>
17
+ </form>
18
+ </body>
19
+ </html>
@@ -1 +1 @@
1
- (function(){tinymce.PluginManager.requireLangPack('addvideo');tinymce.create('tinymce.plugins.AddvideoPlugin',{init:function(ed,url){ed.addCommand('mceAddvideo',function(){ed.windowManager.open({file:url+'/dialog.htm',width:320+parseInt(ed.getLang('addvideo.delta_width',0)),height:120+parseInt(ed.getLang('addvideo.delta_height',0)),inline:1},{plugin_url:url,some_custom_arg:'custom arg'})});ed.addButton('addvideo',{title:'addvideo.desc',cmd:'mceAddvideo',image:url+'/img/youtube.gif'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('youtube',n.nodeName=='IMG')})},createControl:function(n,cm){return null},getInfo:function(){return{longname:'Addvideo plugin',author:'Some author',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/addvideo',version:"1.0"}}});tinymce.PluginManager.add('addvideo',tinymce.plugins.AddvideoPlugin)})();
1
+ (function(){tinymce.create('tinymce.plugins.AddvideoPlugin',{init:function(ed,url){ed.addCommand('mceAddvideo',function(){ed.windowManager.open({file:url+'/addvideo.htm',width:320+parseInt(ed.getLang('addvideo.delta_width',0)),height:130+parseInt(ed.getLang('addvideo.delta_height',0)),inline:1},{plugin_url:url})});ed.addButton('addvideo',{title:'Add youtube video',cmd:'mceAddvideo',image:url+'/img/youtube.gif'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('youtube',n.nodeName=='IMG')})},createControl:function(n,cm){return null},getInfo:function(){return{longname:'Addvideo plugin',author:'Some author',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/addvideo',version:"1.0"}}});tinymce.PluginManager.add('addvideo',tinymce.plugins.AddvideoPlugin)})();
@@ -9,35 +9,23 @@
9
9
  */
10
10
 
11
11
  (function() {
12
- // Load plugin specific language pack
13
- tinymce.PluginManager.requireLangPack('addvideo');
14
-
15
12
  tinymce.create('tinymce.plugins.AddvideoPlugin', {
16
- /**
17
- * Initializes the plugin, this will be executed after the plugin has been created.
18
- * This call is done before the editor instance has finished it's initialization so use the onInit event
19
- * of the editor instance to intercept that event.
20
- *
21
- * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
22
- * @param {string} url Absolute URL to where the plugin is located.
23
- */
24
13
  init : function(ed, url) {
25
14
  // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
26
15
  ed.addCommand('mceAddvideo', function() {
27
16
  ed.windowManager.open({
28
- file : url + '/dialog.htm',
17
+ file : url + '/addvideo.htm',
29
18
  width : 320 + parseInt(ed.getLang('addvideo.delta_width', 0)),
30
- height : 120 + parseInt(ed.getLang('addvideo.delta_height', 0)),
19
+ height :130 + parseInt(ed.getLang('addvideo.delta_height', 0)),
31
20
  inline : 1
32
21
  }, {
33
- plugin_url : url, // Plugin absolute URL
34
- some_custom_arg : 'custom arg' // Custom argument
22
+ plugin_url : url
35
23
  });
36
24
  });
37
25
 
38
26
  // Register addvideo button
39
27
  ed.addButton('addvideo', {
40
- title : 'addvideo.desc',
28
+ title : 'Add youtube video',
41
29
  cmd : 'mceAddvideo',
42
30
  image : url + '/img/youtube.gif'
43
31
  });
@@ -0,0 +1,35 @@
1
+ tinyMCEPopup.requireLangPack();
2
+
3
+ var AddvideoDialog = {
4
+ init : function() {
5
+ var f = document.forms[0];
6
+
7
+ // Get the selected contents as text and place it in the input
8
+ f.videourl.value = tinyMCEPopup.editor.selection.getContent({format : 'text'});
9
+ f.videtitle.value = tinyMCEPopup.editor.selection.getContent({format : 'text'});
10
+ },
11
+
12
+ insert : function() {
13
+ // Insert the contents from the input into the document
14
+
15
+ // VIDEO URL
16
+ var url = document.forms[0].videourl.value;
17
+
18
+ // VIDEO Title
19
+ var title = document.forms[0].videotitle.value;
20
+
21
+ // REGEXP
22
+ var re=new RegExp(/[\\?\\&]v=([^\\?\\&]+)/);
23
+
24
+ // VIDEO ID
25
+ var videoid = re.exec(url);
26
+
27
+ // Add Link and img to the body
28
+
29
+ tinyMCEPopup.editor.execCommand('mceInsertContent', false, "<a href='" + url + "' title='" + title + "' class='fancy-youtube'><img src='http://img.youtube.com/vi/" + videoid[1] + "/1.jpg' alt='" + title + "' /></a>");
30
+ tinyMCEPopup.close();
31
+ }
32
+ };
33
+
34
+ AddvideoDialog.init();
35
+ tinyMCEPopup.onInit.add(AddvideoDialog.init, AddvideoDialog);
@@ -25,7 +25,8 @@ var AddvideoDialog = {
25
25
  var videoid = re.exec(url);
26
26
 
27
27
  // Add Link and img to the body
28
- tinyMCEPopup.editor.execCommand('mceInsertContent', false, "<a href='" + url + "' title='" + title + "'><img src='http://img.youtube.com/vi/" + videoid[3] + videoid[4] + "/1.jpg' alt='" + title + "' /></a>");
28
+
29
+ tinyMCEPopup.editor.execCommand('mceInsertContent', false, "<a href='" + url + "' title='" + title + "' class='fancy-youtube'><img src='http://img.youtube.com/vi/" + videoid[3] + videoid[4] + "/1.jpg' alt='" + title + "' /></a>");
29
30
  tinyMCEPopup.close();
30
31
  }
31
32
  };
@@ -1,3 +1,3 @@
1
- tinyMCE.addI18n('en.addvideo',{
2
- desc : 'This is just a template button'
3
- });
1
+ tinyMCE.addI18n('en.addvideo',{
2
+ desc:"Add Youtube Video desc"
3
+ });
@@ -1,3 +1,3 @@
1
1
  tinyMCE.addI18n('en.addvideo_dlg',{
2
- title : 'This is just a example title'
2
+ title:"Add Youtube Video"
3
3
  });
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noodall-ui
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 6
10
- version: 0.3.6
9
+ - 7
10
+ version: 0.3.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Steve England
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-21 00:00:00 +01:00
18
+ date: 2011-04-27 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -372,10 +372,12 @@ files:
372
372
  - public/javascripts/tiny_mce/jquery.tinymce.js
373
373
  - public/javascripts/tiny_mce/langs/en.js
374
374
  - public/javascripts/tiny_mce/license.txt
375
+ - public/javascripts/tiny_mce/plugins/addvideo/addvideo.htm
375
376
  - public/javascripts/tiny_mce/plugins/addvideo/dialog.htm
376
377
  - public/javascripts/tiny_mce/plugins/addvideo/editor_plugin.js
377
378
  - public/javascripts/tiny_mce/plugins/addvideo/editor_plugin_src.js
378
379
  - public/javascripts/tiny_mce/plugins/addvideo/img/youtube.gif
380
+ - public/javascripts/tiny_mce/plugins/addvideo/js/addvideo.js
379
381
  - public/javascripts/tiny_mce/plugins/addvideo/js/dialog.js
380
382
  - public/javascripts/tiny_mce/plugins/addvideo/langs/en.js
381
383
  - public/javascripts/tiny_mce/plugins/addvideo/langs/en_dlg.js