free_text 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/lib/free_text/version.rb +3 -0
- data/lib/free_text.rb +34 -0
- data/lib/generators/free_text/initializer/initializer_generator.rb +15 -0
- data/lib/generators/free_text/initializer/templates/README +16 -0
- data/lib/generators/free_text/initializer/templates/free-text.rb +149 -0
- data/lib/generators/free_text/initializer/templates/free_text_repository_helper.rb +12 -0
- data/lib/generators/free_text/initializer/templates/migration_create_free_text_texts.rb +11 -0
- metadata +54 -0
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 cgorrieri
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# FreeText
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'free_text'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install free_text
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/lib/free_text.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require "free_text/version"
|
2
|
+
|
3
|
+
module FreeText
|
4
|
+
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
isolate_namespace FreeText
|
7
|
+
initializer 'engine.helper' do |app|
|
8
|
+
ActionView::Base.send :include, TextHelper
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
mattr_accessor :authentication
|
13
|
+
@@authentication = Proc.new {|controller| true}
|
14
|
+
|
15
|
+
# Aloha's plugin enabled
|
16
|
+
mattr_accessor :plugins
|
17
|
+
@@plugins = ""
|
18
|
+
|
19
|
+
# Aloha configuration
|
20
|
+
mattr_accessor :settings
|
21
|
+
@@settings = ""
|
22
|
+
|
23
|
+
# Proc wich give a list of items
|
24
|
+
mattr_accessor :getRepositories
|
25
|
+
@@getRepositories = Proc.new { |c| {} }
|
26
|
+
|
27
|
+
# Proc wich give a list of items
|
28
|
+
mattr_accessor :alohaVersion
|
29
|
+
@@alohaVersion = "0.10.0"
|
30
|
+
|
31
|
+
def self.setup
|
32
|
+
yield self
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module FreeText
|
2
|
+
module Generators
|
3
|
+
class InitializerGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../templates", __FILE__)
|
5
|
+
|
6
|
+
def copy_initializer
|
7
|
+
copy_file "free-text.rb", "config/initializers/free-text.rb"
|
8
|
+
copy_file "free_text_repository_helper.rb", "app/helpers/free_text_repository_helper.rb"
|
9
|
+
copy_file "migration_create_free_text_texts.rb", "db/migrate/#{Time.new.strftime("%Y%m%d%H%M%S")}_create_free_text_texts.rb"
|
10
|
+
# route "match '/freetext-repositories' => 'free_text_repository#get', :as => :free_text_repository"
|
11
|
+
readme "README"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
===============================================================================
|
2
|
+
|
3
|
+
Some setup you must do manually if you haven't yet:
|
4
|
+
|
5
|
+
1. Run 'rake db:migrate'
|
6
|
+
|
7
|
+
2. Add '<%= free_text_init %>' in the header of the layout
|
8
|
+
|
9
|
+
3. Add ,<%= free_text key [, options={}] %> in pages to add an editable text
|
10
|
+
|
11
|
+
4. Configure the gem in 'config/initializers/free-text.rb'
|
12
|
+
|
13
|
+
5. To add repositories update the methode 'get' in FreeTextRepository
|
14
|
+
controller
|
15
|
+
|
16
|
+
===============================================================================
|
@@ -0,0 +1,149 @@
|
|
1
|
+
include FreeTextRepositoryHelper
|
2
|
+
|
3
|
+
FreeText.setup do |config|
|
4
|
+
# See aloha-editor.org
|
5
|
+
|
6
|
+
#config.authentication = Proc.new { |controller| controller.admin_signed_in? }
|
7
|
+
|
8
|
+
# If set, it always start with ','
|
9
|
+
config.plugins = ",common/table,common/link,common/list,common/undo,common/contenthandler,common/image,extra/browser,extra/linkbrowser"
|
10
|
+
|
11
|
+
# Static settings of aloha
|
12
|
+
config.settings = <<-JAVASCRIPT
|
13
|
+
logLevels : {'error': false,'warn': false, 'info': false, 'debug': false, 'deprecated': false },
|
14
|
+
locale: 'fr',
|
15
|
+
plugins: {
|
16
|
+
format: {
|
17
|
+
config: ['b', 'i', 'u', 'sub', 'sup', 'p','h1', 'h2', 'h3', 'removeFormat'],
|
18
|
+
editables: {
|
19
|
+
'.content': ['b', 'i', 'u', 'sub', 'sup', 'p', 'h2', 'h3', 'removeFormat'],
|
20
|
+
'.text_only': ['b', 'i', 'u', 'sup', 'removeFormat']
|
21
|
+
},
|
22
|
+
// those are the tags that will be cleaned when clicking 'remove formatting'
|
23
|
+
removeFormats: [ 'strong', 'em', 'b', 'i', 'cite', 'q', 'code', 'abbr', 'del', 'sub', 'sup']
|
24
|
+
},
|
25
|
+
list: {
|
26
|
+
config: ['ul', 'ol'],
|
27
|
+
editables: {
|
28
|
+
'.text_only': []
|
29
|
+
}
|
30
|
+
},
|
31
|
+
link: {
|
32
|
+
// all elements with no specific configuration may insert links
|
33
|
+
config: [ 'a' ],
|
34
|
+
/*hotKey: {
|
35
|
+
// use ctrl+l instead of ctrl+k as hotkey for inserting a link
|
36
|
+
//insertLink: 'ctrl+l'
|
37
|
+
},*/
|
38
|
+
editables: {
|
39
|
+
// No links in the title.
|
40
|
+
'.text_only': []
|
41
|
+
},
|
42
|
+
target: '_blank',
|
43
|
+
// the same for css class as for target
|
44
|
+
//cssclassregex: '^(?!.*aloha-editor.com).*',
|
45
|
+
//cssclass: 'aloha',
|
46
|
+
// use all resources of type website for autosuggest
|
47
|
+
//objectTypeFilter: ['website'],
|
48
|
+
// handle change of href
|
49
|
+
/*onHrefChange: function ( obj, href, item ) {
|
50
|
+
var jQuery = Aloha.require( 'aloha/jquery' );
|
51
|
+
if ( item ) {
|
52
|
+
jQuery( obj ).attr( 'data-name', item.name );
|
53
|
+
} else {
|
54
|
+
jQuery( obj ).removeAttr( 'data-name' );
|
55
|
+
}
|
56
|
+
}*/
|
57
|
+
},
|
58
|
+
table: {
|
59
|
+
// all elements with no specific configuration are not allowed to insert tables
|
60
|
+
config: [ 'table' ],
|
61
|
+
editables: {
|
62
|
+
// Don't allow tables in top-text
|
63
|
+
'.text_only': []
|
64
|
+
},
|
65
|
+
summaryinsidebar: true,
|
66
|
+
// [{name:'green', text:'Green', tooltip:'Green is cool', iconClass:'GENTICS_table GENTICS_button_green', cssClass:'green'}]
|
67
|
+
tableConfig: [
|
68
|
+
{ name: 'hor-minimalist-a' },
|
69
|
+
{ name: 'box-table-a' },
|
70
|
+
{ name: 'hor-zebra' },
|
71
|
+
],
|
72
|
+
columnConfig: [
|
73
|
+
{ name: 'table-style-bigbold', iconClass: 'aloha-button-col-bigbold' },
|
74
|
+
{ name: 'table-style-redwhite', iconClass: 'aloha-button-col-redwhite' }
|
75
|
+
],
|
76
|
+
rowConfig: [
|
77
|
+
{ name: 'table-style-bigbold', iconClass: 'aloha-button-row-bigbold' },
|
78
|
+
{ name: 'table-style-redwhite', iconClass: 'aloha-button-row-redwhite' }
|
79
|
+
]
|
80
|
+
},
|
81
|
+
image: {
|
82
|
+
config:{
|
83
|
+
'fixedAspectRatio' : false,
|
84
|
+
'maxWidth' : 600,
|
85
|
+
'minWidth' : 20,
|
86
|
+
'maxHeight' : 600,
|
87
|
+
'minHeight' : 20,
|
88
|
+
'globalselector' : '.global',
|
89
|
+
'ui': {
|
90
|
+
'oneTab': true
|
91
|
+
}
|
92
|
+
},
|
93
|
+
editables: {
|
94
|
+
// Don't allow tables in top-text
|
95
|
+
'.text_only': []
|
96
|
+
},
|
97
|
+
'fixedAspectRatio' : false,
|
98
|
+
'maxWidth' : 600,
|
99
|
+
'minWidth' : 20,
|
100
|
+
'maxHeight' : 600,
|
101
|
+
'minHeight' : 20,
|
102
|
+
'globalselector' : '.global',
|
103
|
+
'ui': {
|
104
|
+
'oneTab' : true,
|
105
|
+
'align' : false,
|
106
|
+
'margin' : false
|
107
|
+
}
|
108
|
+
},
|
109
|
+
cite: {
|
110
|
+
referenceContainer: '#references'
|
111
|
+
},
|
112
|
+
formatlesspaste :{
|
113
|
+
formatlessPasteOption : true,
|
114
|
+
strippedElements : [
|
115
|
+
'em',
|
116
|
+
'strong',
|
117
|
+
'small',
|
118
|
+
's',
|
119
|
+
'cite',
|
120
|
+
'q',
|
121
|
+
'dfn',
|
122
|
+
'abbr',
|
123
|
+
'time',
|
124
|
+
'code',
|
125
|
+
'var',
|
126
|
+
'samp',
|
127
|
+
'kbd',
|
128
|
+
'sub',
|
129
|
+
'sup',
|
130
|
+
'i',
|
131
|
+
'b',
|
132
|
+
'u',
|
133
|
+
'mark',
|
134
|
+
'ruby',
|
135
|
+
'rt',
|
136
|
+
'rp',
|
137
|
+
'bdi',
|
138
|
+
'bdo',
|
139
|
+
'ins',
|
140
|
+
'del'
|
141
|
+
]
|
142
|
+
}
|
143
|
+
},
|
144
|
+
JAVASCRIPT
|
145
|
+
|
146
|
+
# get an hash wich define a list of items
|
147
|
+
config.getRepositories = Proc.new { |c| FreeTextRepositoryHelper.get_repositories(c) }
|
148
|
+
|
149
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module FreeTextRepositoryHelper
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
def get_repositories
|
6
|
+
# Example of repositories
|
7
|
+
# { name: 'Aloha Developers Wiki', url:'https://github.com/alohaeditor/Aloha-Editor/wiki', type:'website', weight: 0.50 }
|
8
|
+
# { name: 'Aloha Editor - The HTML5 Editor', url:'http://aloha-editor.com', type:'website', weight: 0.90 }
|
9
|
+
|
10
|
+
{:repositories => {}}
|
11
|
+
end
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: free_text
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- cgorrieri
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-09 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Insert FreeText description.
|
15
|
+
email:
|
16
|
+
- cyril.gorrieri@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- lib/generators/free_text/initializer/templates/free_text_repository_helper.rb
|
22
|
+
- lib/generators/free_text/initializer/templates/migration_create_free_text_texts.rb
|
23
|
+
- lib/generators/free_text/initializer/templates/README
|
24
|
+
- lib/generators/free_text/initializer/templates/free-text.rb
|
25
|
+
- lib/generators/free_text/initializer/initializer_generator.rb
|
26
|
+
- lib/free_text.rb
|
27
|
+
- lib/free_text/version.rb
|
28
|
+
- LICENSE
|
29
|
+
- README.md
|
30
|
+
homepage: https://github.com/cgorrieri/free-text
|
31
|
+
licenses: []
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirements: []
|
49
|
+
rubyforge_project:
|
50
|
+
rubygems_version: 1.8.24
|
51
|
+
signing_key:
|
52
|
+
specification_version: 3
|
53
|
+
summary: A WYSIWYG editor with save.
|
54
|
+
test_files: []
|