-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
223 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "tinymce"] | ||
path = tinymce | ||
path = app/assets/javascripts/tinymce | ||
url = [email protected]:tinymce/tinymce-dist.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
source "https://rubygems.org" | ||
|
||
gemspec | ||
|
||
git "http://github.com/refinery/refinerycms", branch: "master" do | ||
gem "refinerycms" | ||
gem "refinerycms-testing" | ||
end | ||
|
||
gem 'sqlite3' | ||
gem 'pry' | ||
|
||
group :development, :test do | ||
gem 'selenium-webdriver', '~> 2.43' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env rake | ||
begin | ||
require 'bundler/setup' | ||
rescue LoadError | ||
puts 'You must `gem install bundler` and `bundle install` to run rake tasks' | ||
end | ||
|
||
ENGINE_PATH = File.dirname(__FILE__) | ||
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__) | ||
|
||
if File.exists?(APP_RAKEFILE) | ||
load 'rails/tasks/engine.rake' | ||
end | ||
|
||
require "refinerycms-testing" | ||
Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH) | ||
|
||
task :default => :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Refinery | ||
class TinymceController < ActionController::Base | ||
|
||
def tinymceiframe | ||
render :template => "/refinery/tinymceiframe", :layout => false | ||
end | ||
|
||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
app/assets/decorators/controllers/refinery/fast_controller_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Refinery::FastController.class_eval do | ||
def tinymceiframe | ||
render :template => "/refinery/tinymceiframe", :layout => false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
$(document).on('ready page:load', function(){ | ||
|
||
tinymce.init({ | ||
selector: "textarea.visual_editor", | ||
menubar : false, | ||
plugins: ["image", "link"], | ||
|
||
file_browser_callback : function(field_name, url, type, win) { | ||
|
||
if (type == 'image') { | ||
var title_text = "Choose an Image" | ||
var cmsURL = '/refinery/dialogs/image'; | ||
} else { | ||
var title_text = "Choose Object to Link" | ||
var cmsURL = '/refinery/dialogs/link'; | ||
} | ||
|
||
tinymce.activeEditor.windowManager.open({ | ||
file : cmsURL, | ||
title : title_text, | ||
width : 600, // Your dimensions may differ - toy around with them! | ||
height : 600, | ||
resizable : "yes", | ||
inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin! | ||
close_previous : "yes" | ||
}, { | ||
window : win, | ||
input : field_name | ||
}); | ||
} | ||
}); | ||
|
||
$('#submit_button').on('click', function(event){ | ||
var args = top.tinymce.activeEditor.windowManager.getParams(); | ||
win = (args.window); | ||
input = (args.input); | ||
dialog_type = $('#visual_editor_dialog_type', window.parent.document).val(); | ||
|
||
if (dialog_type == 'link') { | ||
selector = "#visual_editor_href"; | ||
} else { | ||
selector = "#visual_editor_src"; | ||
} | ||
win.document.getElementById(input).value = $(selector, window.parent.document).val(); | ||
// window.alert( JSON.stringify(args) ); | ||
top.tinymce.activeEditor.windowManager.close(); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* TINYMCE | ||
*/ | ||
|
||
/* | ||
Namespace: TINYMCE | ||
Global Tinymce namespace. | ||
*/ | ||
/* | ||
*= require tinymce/tinymce | ||
*= require tinymce/tinymce.jquery | ||
*= require refinery/boot_tinymce | ||
*= require_self | ||
*/ |
Submodule tinymce
updated
from 000000 to 503d6f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#dialog_container, .dialog_container { | ||
margin-left: 20px; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<form id='visual_editor_dialog_form' class='visual_editor_dialog visual_editor_dialog_<%= @dialog_type %>'> | ||
<input type='hidden' id='visual_editor_dialog_type' class='visual_editor_dialog_type' value='<%= @dialog_type %>' /> | ||
<iframe src='<%= @iframe_src %>' id='dialog_frame' frameborder='0' marginheight='0' marginwidth='0' border='0' height='570px' width='550px'></iframe> | ||
<div class='wym_hideables'> | ||
<% if @dialog_type == "image" %> | ||
<input type='hidden' id='visual_editor_src' class='visual_editor_src' value='' /> | ||
<input type='hidden' id='visual_editor_alt' class='visual_editor_alt' value='' /> | ||
<input type='hidden' id='visual_editor_title' class='visual_editor_title' value='' /> | ||
<input type='hidden' id='visual_editor_size' class='visual_editor_size' value='' /> | ||
<% elsif @dialog_type == "link" %> | ||
<input type='hidden' id='visual_editor_href' class='visual_editor_href' value='' /> | ||
<input type='hidden' id='visual_editor_title' class='visual_editor_title' value='' /> | ||
<input type='hidden' id='visual_editor_target' class='visual_editor_target' value='' /> | ||
<% end %> | ||
</div> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>TinyMCE</title> | ||
<meta charset='<%= ::Rails.application.config.encoding %>' /> | ||
<meta httpequiv="XUACompatible" content="IE=edge,chrome=1" /> | ||
<%#= stylesheet_link_tag "tinymce/skins/lightgray/skin.min", :media => "all" %> | ||
<%= stylesheet_link_tag "formatting", :media => "all" if Rails.application.assets.find_asset('formatting.css') %> | ||
<%= javascript_include_tag 'modernizr-min' %> | ||
</head> | ||
<body class="tinymce_iframe<%= " #{params[:id]}" if params[:id].present? %>"> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Refinery::Core::Engine.routes.draw do | ||
get 'tinymceiframe(/:id)', :to => 'fast#tinymceiframe', :as => :tinymceiframe | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module Refinery | ||
module Tinymce | ||
require 'refinery/tinymce/engine' | ||
|
||
class << self | ||
def root | ||
@root ||= Pathname.new(File.expand_path('../../../', __FILE__)) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module Refinery | ||
module Tinymce | ||
class Engine < ::Rails::Engine | ||
include Refinery::Engine | ||
|
||
isolate_namespace Refinery | ||
engine_name :refinery_tinymce | ||
|
||
# set the manifests and assets to be precompiled | ||
config.to_prepare do | ||
Rails.application.config.assets.precompile += %w( | ||
tinymce/themes/modern/theme.min.js | ||
tinymce.css | ||
tinymce/skins/lightgray/* | ||
) | ||
end | ||
|
||
before_inclusion do | ||
Refinery::Plugin.register do |plugin| | ||
plugin.pathname = root | ||
plugin.name = "refinerycms_tinymce" | ||
plugin.hide_from_menu = true | ||
plugin.menu_match = %r{refinery/tinymce} | ||
end | ||
end | ||
|
||
config.after_initialize do | ||
Refinery.register_engine Refinery::Tinymce | ||
end | ||
|
||
after_inclusion do | ||
%w(tinymce/skins/lightgray/skin.min tinymce).each do |stylesheet| | ||
Refinery::Core.config.register_visual_editor_stylesheet stylesheet | ||
end | ||
|
||
%W(refinery/tinymce tinymce/themes/modern/theme.min).each do |javascript| | ||
Refinery::Core.config.register_visual_editor_javascript javascript | ||
end | ||
|
||
Refinery::Pages.config.friendly_id_reserved_words << 'tinymceiframe' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require 'refinerycms-core' | ||
require 'refinery/tinymce' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# TinyMCE Visual Editing for RefineryCMS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Encoding: UTF-8 | ||
Gem::Specification.new do |s| | ||
s.platform = Gem::Platform::RUBY | ||
s.name = %q{refinerycms-tinymce} | ||
s.version = '1.0.0' | ||
s.summary = %q{TinyMCE support for Refinery CMS} | ||
s.description = %q{This extension adds TinyMCE editor to Refinery CMS for visual editing.} | ||
s.email = %q{[email protected]} | ||
s.homepage = %q{http://refinerycms.com} | ||
s.authors = ['Glenn Hoppe'] | ||
s.license = %q{MIT} | ||
s.require_paths = %w(lib) | ||
|
||
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- spec/*`.split("\n") | ||
|
||
s.add_dependency 'refinerycms-core', '~> 3.0', '>= 3.0.0' | ||
end |