Skip to content
This repository has been archived by the owner on Apr 5, 2018. It is now read-only.

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
did committed Jan 20, 2012
0 parents commit 6ceb0ea
Show file tree
Hide file tree
Showing 1,620 changed files with 287,616 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
.bundle
/tmp
tmp/**/*
*.gem
.rvmrc
.rbenv-version
pkg/
18 changes: 18 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright (C) 2012 by Didier Lafforgue

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Rails 3.1 Integration for Aloha Editor
=================================

The `aloha-rails` gem integrates the [AlohaEditor](http://aloha-editor.org/) editor with the Rails 3.1 asset pipeline.


Instructions
------------

**1. Add `aloha-rails` to your Gemfile**

gem 'aloha-rails'

Then run `bundle install`.


**2. Use AlohaEditor**

Add to your application.js:

//= require aloha

and use AlohaEditor in your view:

<script type="text/javascript">
Aloha.ready( function() {

// Make #content editable once Aloha is loaded and ready.
Aloha.jQuery('#content').aloha();

});
</script

Credits
-------

[Sam Pohlenz](https://github.com/spohlenz) for his [tinymce-rails plugin](https://github.com/spohlenz/tinymce-rails) as a blueprint.

Contact
-------

Feel free to contact me at didier at nocoffee dot fr.

Copyright (c) 2012 NoCoffee
57 changes: 57 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
require 'rubygems'
require 'rake'
require 'rubygems/package_task'

gemspec = eval(File.read('locomotive-aloha-rails.gemspec'))
Gem::PackageTask.new(gemspec) do |pkg|
pkg.gem_spec = gemspec
end

unless defined? Aloha::VERSION
$:.unshift File.expand_path("../lib", __FILE__)
require "aloha/version"
end

def step(name)
print "#{name} ..."
yield
puts " DONE"
end

def download(url, filename)
puts "Downloading #{url} ..."
`mkdir -p tmp`
`curl -L -# #{url} -o tmp/#{filename}`
end

desc "Update Aloha Editor to version specified in lib/tinymce/version.rb"
task :update => [ :fetch, :extract, :process ]

task :fetch do
download("https://github.com/downloads/alohaeditor/Aloha-Editor/alohaeditor-#{Aloha::ALOHA_EDITOR_VERSION}.zip", "alohaeditor.zip")
end

task :extract do
step "Extracting core files" do
`rm -rf tmp/aloha`
`unzip -u tmp/alohaeditor.zip -d tmp`

%w(build.txt package.json).each { |file| `rm tmp/aloha/#{file}` }
%w(demo test).each { |folder| `rm -rf tmp/aloha/#{folder}` }

`rm -rf assets/vendor/aloha`
`mkdir -p assets/vendor/aloha`
`mv tmp/aloha assets/vendor/.`
end
end

task :process do
step "Fixing file encoding" do
require 'iconv'
converter = Iconv.new('UTF-8', 'ISO-8859-1')
Dir["assets/vendor/aloha/**/*.js"].each do |file|
contents = converter.iconv(File.read(file)).force_encoding('UTF-8')
File.open(file, 'w') { |f| f.write(contents) }
end
end
end
3 changes: 3 additions & 0 deletions assets/integration/aloha.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/*
*= require aloha/css/aloha.css
*/
2 changes: 2 additions & 0 deletions assets/integration/aloha.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//= require aloha/preinit.js
//= require aloha/lib/aloha.js
1 change: 1 addition & 0 deletions assets/integration/aloha/preinit.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Aloha.settings.baseUrl = '<%= Rails.application.config.assets.prefix %>/aloha/lib/';
44 changes: 44 additions & 0 deletions assets/vendor/aloha/css/aloha-core.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.aloha-editable {
min-height: 1.2em;
outline: none;
}
.aloha-editable ::selection,
.aloha-editable ::-moz-selection {
background: #80B5F2;
color: white;
}
.aloha-editable-zerowidthfix {
padding: 0px 5px 0px 5px !important;
}



.aloha-logo {
width:37px !important;
height:25px !important;
background-image: url('../img/gentics-logo.png') !important;
}
.aloha-maximize {
background-image: url('../img/gentics-logo.png') !important;
}
.aloha-fade-out {
background-image: url('../img/fade-out.png') !important;
width:20px !important;
height:20px !important;
}
.aloha-fade-in {
background-image: url('../img/fade-in.png') !important;
width:20px !important;
height:20px !important;
}
.aloha-maximize {
width:20px !important;
height:20px !important;
background-image: url('../img/maximize.png') !important;
}
.aloha-textarea {
overflow: hidden;
border:1px solid #ccc;
padding:6px;
overflow:auto;
}
Loading

0 comments on commit 6ceb0ea

Please sign in to comment.