elrte 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.rdoc +33 -0
- data/Rakefile +1 -0
- data/app/assets/images/elrte-toolbar.png +0 -0
- data/app/assets/images/google-maps.png +0 -0
- data/app/assets/images/iframe.png +0 -0
- data/app/assets/images/loading.gif +0 -0
- data/app/assets/images/media-director.png +0 -0
- data/app/assets/images/media-flash.png +0 -0
- data/app/assets/images/media-quicktime.png +0 -0
- data/app/assets/images/media-realaudio.png +0 -0
- data/app/assets/images/media-rutube.png +0 -0
- data/app/assets/images/media-vimeo.png +0 -0
- data/app/assets/images/media-winmedia.png +0 -0
- data/app/assets/images/media-youtube.png +0 -0
- data/app/assets/images/outline-div.png +0 -0
- data/app/assets/images/outline-p.png +0 -0
- data/app/assets/images/pagebreak.gif +0 -0
- data/app/assets/images/pixel.gif +0 -0
- data/app/assets/images/smileys/evilgrin.png +0 -0
- data/app/assets/images/smileys/grin.png +0 -0
- data/app/assets/images/smileys/happy.png +0 -0
- data/app/assets/images/smileys/smile.png +0 -0
- data/app/assets/images/smileys/surprised.png +0 -0
- data/app/assets/images/smileys/tongue.png +0 -0
- data/app/assets/images/smileys/unhappy.png +0 -0
- data/app/assets/images/smileys/waii.png +0 -0
- data/app/assets/images/smileys/wink.png +0 -0
- data/app/assets/images/yandex-maps.png +0 -0
- data/app/assets/javascripts/elrte/base.js +5 -0
- data/app/assets/javascripts/elrte/toolbar.js +5 -0
- data/app/assets/stylesheets/elrte/active_admin.css.scss +8 -0
- data/app/assets/stylesheets/elrte/base.css.scss +6 -0
- data/app/controllers/elfinder_controller.rb +29 -0
- data/doc/README_rdoc.html +103 -0
- data/doc/created.rid +2 -0
- data/doc/index.html +54 -0
- data/doc/rdoc.css +706 -0
- data/elrte.gemspec +30 -0
- data/lib/elrte.rb +33 -0
- data/lib/elrte/application.rb +273 -0
- data/lib/elrte/dependency_checker.rb +11 -0
- data/lib/elrte/engine.rb +4 -0
- data/lib/elrte/router.rb +34 -0
- data/lib/elrte/version.rb +3 -0
- data/lib/generators/elrte/assets/assets_generator.rb +39 -0
- data/lib/generators/elrte/assets/templates/3.1/elrte.css.scss +4 -0
- data/lib/generators/elrte/assets/templates/3.1/elrte.js +26 -0
- data/lib/generators/elrte/assets/templates/dashboards.rb +36 -0
- data/lib/generators/elrte/install/install_generator.rb +24 -0
- data/vendor/assets/images/elfinder/icons-big.png +0 -0
- data/vendor/assets/images/elfinder/icons-small.png +0 -0
- data/vendor/assets/images/elfinder/ql.png +0 -0
- data/vendor/assets/images/elfinder/smoothness/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/images/elfinder/smoothness/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/vendor/assets/images/elfinder/smoothness/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/vendor/assets/images/elfinder/smoothness/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/images/elfinder/smoothness/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/vendor/assets/images/elfinder/smoothness/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/vendor/assets/images/elfinder/smoothness/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/vendor/assets/images/elfinder/smoothness/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/vendor/assets/images/elfinder/smoothness/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/images/elfinder/smoothness/ui-icons_2e83ff_256x240.png +0 -0
- data/vendor/assets/images/elfinder/smoothness/ui-icons_454545_256x240.png +0 -0
- data/vendor/assets/images/elfinder/smoothness/ui-icons_888888_256x240.png +0 -0
- data/vendor/assets/images/elfinder/smoothness/ui-icons_cd0a0a_256x240.png +0 -0
- data/vendor/assets/images/elfinder/spinner.gif +0 -0
- data/vendor/assets/images/elfinder/toolbar.png +0 -0
- data/vendor/assets/images/elrte/elrte-toolbar.png +0 -0
- data/vendor/assets/images/elrte/google-maps.png +0 -0
- data/vendor/assets/images/elrte/iframe.png +0 -0
- data/vendor/assets/images/elrte/loading.gif +0 -0
- data/vendor/assets/images/elrte/media-director.png +0 -0
- data/vendor/assets/images/elrte/media-flash.png +0 -0
- data/vendor/assets/images/elrte/media-quicktime.png +0 -0
- data/vendor/assets/images/elrte/media-realaudio.png +0 -0
- data/vendor/assets/images/elrte/media-rutube.png +0 -0
- data/vendor/assets/images/elrte/media-vimeo.png +0 -0
- data/vendor/assets/images/elrte/media-winmedia.png +0 -0
- data/vendor/assets/images/elrte/media-youtube.png +0 -0
- data/vendor/assets/images/elrte/outline-div.png +0 -0
- data/vendor/assets/images/elrte/outline-p.png +0 -0
- data/vendor/assets/images/elrte/pagebreak.gif +0 -0
- data/vendor/assets/images/elrte/pixel.gif +0 -0
- data/vendor/assets/images/elrte/smileys/evilgrin.png +0 -0
- data/vendor/assets/images/elrte/smileys/grin.png +0 -0
- data/vendor/assets/images/elrte/smileys/happy.png +0 -0
- data/vendor/assets/images/elrte/smileys/smile.png +0 -0
- data/vendor/assets/images/elrte/smileys/surprised.png +0 -0
- data/vendor/assets/images/elrte/smileys/tongue.png +0 -0
- data/vendor/assets/images/elrte/smileys/unhappy.png +0 -0
- data/vendor/assets/images/elrte/smileys/waii.png +0 -0
- data/vendor/assets/images/elrte/smileys/wink.png +0 -0
- data/vendor/assets/images/elrte/smoothness/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/images/elrte/smoothness/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/vendor/assets/images/elrte/smoothness/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/vendor/assets/images/elrte/smoothness/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/images/elrte/smoothness/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/vendor/assets/images/elrte/smoothness/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/vendor/assets/images/elrte/smoothness/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/vendor/assets/images/elrte/smoothness/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/vendor/assets/images/elrte/smoothness/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/images/elrte/smoothness/ui-icons_2e83ff_256x240.png +0 -0
- data/vendor/assets/images/elrte/smoothness/ui-icons_454545_256x240.png +0 -0
- data/vendor/assets/images/elrte/smoothness/ui-icons_888888_256x240.png +0 -0
- data/vendor/assets/images/elrte/smoothness/ui-icons_cd0a0a_256x240.png +0 -0
- data/vendor/assets/images/elrte/yandex-maps.png +0 -0
- data/vendor/assets/javascripts/elfinder/elfinder.min.js +1 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.cs.js +192 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.de.js +192 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.el.js +190 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.es.js +191 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.fr.js +192 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.hu.js +192 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.it.js +191 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.jp.js +191 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.lv.js +192 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.nl.js +190 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.pl.js +191 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.ru.js +200 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.sk.js +190 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.th.js +191 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.tr.js +191 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.uk.js +190 -0
- data/vendor/assets/javascripts/elfinder/i18n/elfinder.vi.js +192 -0
- data/vendor/assets/javascripts/elrte/elrte.min.js +267 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.YOUR_LANG.js +216 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.ar.js +168 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.ca.js +167 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.cs.js +171 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.da.js +210 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.de.js +170 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.en.js +11 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.es.js +169 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.fa.js +170 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.fr.js +169 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.hr.js +210 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.hu.js +203 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.it.js +169 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.jp.js +189 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.ko.js +210 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.lv.js +181 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.nl.js +201 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.pl.js +170 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.pt_BR.js +167 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.ru.js +213 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.sk.js +172 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.th.js +210 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.tr.js +210 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.uk.js +203 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.vi.js +209 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.zh_CN.js +189 -0
- data/vendor/assets/javascripts/elrte/i18n/elrte.zh_TW.js +212 -0
- data/vendor/assets/stylesheets/elfinder/elfinder.css.scss +836 -0
- data/vendor/assets/stylesheets/elfinder/smoothness/jquery-ui-1.8.13.custom.css.scss +578 -0
- data/vendor/assets/stylesheets/elrte/elrte-inner.css.scss +85 -0
- data/vendor/assets/stylesheets/elrte/elrte.min.css.scss +174 -0
- data/vendor/assets/stylesheets/elrte/smoothness/jquery-ui-1.8.13.custom.css.scss +578 -0
- metadata +256 -0
data/elrte.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "elrte/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = %q{elrte}
|
7
|
+
s.version = Elrte::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Anton Zaytsev"]
|
10
|
+
s.email = ["info@antonzaytsev.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Provides WYSIWYG editor Elrte for Rails}
|
13
|
+
s.description = %q{Provides WYSIWYG editor Elrte for Rails}
|
14
|
+
|
15
|
+
s.rubyforge_project = "elrte"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency("rails", ">= 3.1.0")
|
23
|
+
s.add_dependency("jquery-rails", ">= 1.0.0")
|
24
|
+
s.add_dependency("sass", ">= 3.1.0")
|
25
|
+
s.add_dependency("el_finder", "> 0")
|
26
|
+
|
27
|
+
# specify any dependencies here; for example:
|
28
|
+
# s.add_development_dependency "rspec"
|
29
|
+
# s.add_runtime_dependency "rest-client"
|
30
|
+
end
|
data/lib/elrte.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require "elrte/version"
|
2
|
+
require 'elrte/application'
|
3
|
+
require 'elrte/engine'
|
4
|
+
|
5
|
+
module Elrte
|
6
|
+
|
7
|
+
autoload :DependencyChecker, 'elrte/dependency_checker'
|
8
|
+
|
9
|
+
class << self
|
10
|
+
|
11
|
+
attr_accessor :application
|
12
|
+
|
13
|
+
def application
|
14
|
+
@application ||= ::Elrte::Application.new
|
15
|
+
end
|
16
|
+
|
17
|
+
# Gets called within the initializer
|
18
|
+
def setup
|
19
|
+
application = Elrte::Application.new
|
20
|
+
application.register_default_assets
|
21
|
+
end
|
22
|
+
|
23
|
+
delegate :routes, :to => :application
|
24
|
+
|
25
|
+
# Returns true if this rails application has the asset
|
26
|
+
# pipeline enabled.
|
27
|
+
def use_asset_pipeline?
|
28
|
+
DependencyChecker.rails_3_1? && Rails.application.config.try(:assets).try(:enabled)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,273 @@
|
|
1
|
+
require 'elrte/router'
|
2
|
+
|
3
|
+
module Elrte
|
4
|
+
class Application
|
5
|
+
#include Settings
|
6
|
+
#
|
7
|
+
## Adds settings to both the Application and the Namespace instance
|
8
|
+
## so that they can be configured independantly.
|
9
|
+
#def self.inheritable_setting(name, default)
|
10
|
+
# Namespace.setting name, nil
|
11
|
+
# setting name, default
|
12
|
+
#end
|
13
|
+
#
|
14
|
+
## The default namespace to put controllers and routes inside. Set this
|
15
|
+
## in config/initializers/active_admin.rb using:
|
16
|
+
##
|
17
|
+
## config.default_namespace = :super_admin
|
18
|
+
##
|
19
|
+
#setting :default_namespace, :admin
|
20
|
+
#
|
21
|
+
## A hash of all the registered namespaces
|
22
|
+
#setting :namespaces, {}
|
23
|
+
#
|
24
|
+
## Load paths for admin configurations. Add folders to this load path
|
25
|
+
## to load up other resources for administration. External gems can
|
26
|
+
## include their paths in this load path to provide active_admin UIs
|
27
|
+
#setting :load_paths, [File.expand_path('app/admin', Rails.root)]
|
28
|
+
#
|
29
|
+
## The default number of resources to display on index pages
|
30
|
+
#inheritable_setting :default_per_page, 30
|
31
|
+
#
|
32
|
+
## The title which gets displayed in the main layout
|
33
|
+
#inheritable_setting :site_title, ""
|
34
|
+
#
|
35
|
+
## Set the site title link href (defaults to AA dashboard)
|
36
|
+
#inheritable_setting :site_title_link, ""
|
37
|
+
#
|
38
|
+
## Set the site title image displayed in the main layout (has precendence over :site_title)
|
39
|
+
#inheritable_setting :site_title_image, ""
|
40
|
+
#
|
41
|
+
## The view factory to use to generate all the view classes. Take
|
42
|
+
## a look at ActiveAdmin::ViewFactory
|
43
|
+
#inheritable_setting :view_factory, ActiveAdmin::ViewFactory.new
|
44
|
+
#
|
45
|
+
## The method to call in controllers to get the current user
|
46
|
+
#inheritable_setting :current_user_method, false
|
47
|
+
#
|
48
|
+
## The method to call in the controllers to ensure that there
|
49
|
+
## is a currently authenticated admin user
|
50
|
+
#inheritable_setting :authentication_method, false
|
51
|
+
#
|
52
|
+
## The path to log user's out with. If set to a symbol, we assume
|
53
|
+
## that it's a method to call which returns the path
|
54
|
+
#inheritable_setting :logout_link_path, :destroy_admin_user_session_path
|
55
|
+
#
|
56
|
+
## The method to use when generating the link for user logout
|
57
|
+
#inheritable_setting :logout_link_method, :get
|
58
|
+
#
|
59
|
+
## Active Admin makes educated guesses when displaying objects, this is
|
60
|
+
## the list of methods it tries calling in order
|
61
|
+
#setting :display_name_methods, [ :display_name,
|
62
|
+
# :full_name,
|
63
|
+
# :name,
|
64
|
+
# :username,
|
65
|
+
# :login,
|
66
|
+
# :title,
|
67
|
+
# :email,
|
68
|
+
# :to_s ]
|
69
|
+
#
|
70
|
+
## == Deprecated Settings
|
71
|
+
#
|
72
|
+
## @deprecated The default sort order for index pages
|
73
|
+
#deprecated_setting :default_sort_order, 'id_desc'
|
74
|
+
#
|
75
|
+
## DEPRECATED: This option is deprecated and will be removed. Use
|
76
|
+
## the #allow_comments_in option instead
|
77
|
+
#attr_accessor :admin_notes
|
78
|
+
#
|
79
|
+
#include AssetRegistration
|
80
|
+
#
|
81
|
+
## Event that gets triggered on load of Active Admin
|
82
|
+
#LoadEvent = 'active_admin.application.load'.freeze
|
83
|
+
#
|
84
|
+
#def setup!
|
85
|
+
# register_default_assets
|
86
|
+
#end
|
87
|
+
#
|
88
|
+
#def prepare!
|
89
|
+
# remove_active_admin_load_paths_from_rails_autoload_and_eager_load
|
90
|
+
# attach_reloader
|
91
|
+
# generate_stylesheets
|
92
|
+
#end
|
93
|
+
#
|
94
|
+
## Registers a brand new configuration for the given resource.
|
95
|
+
#def register(resource, options = {}, &block)
|
96
|
+
# namespace_name = extract_namespace_name(options)
|
97
|
+
# namespace = find_or_create_namespace(namespace_name)
|
98
|
+
# namespace.register(resource, options, &block)
|
99
|
+
#end
|
100
|
+
#
|
101
|
+
## Creates a namespace for the given name
|
102
|
+
##
|
103
|
+
## Yields the namespace if a block is given
|
104
|
+
##
|
105
|
+
## @returns [Namespace] the new or existing namespace
|
106
|
+
#def find_or_create_namespace(name)
|
107
|
+
# name ||= :root
|
108
|
+
# return namespaces[name] if namespaces[name]
|
109
|
+
# namespace = Namespace.new(self, name)
|
110
|
+
# namespaces[name] = namespace
|
111
|
+
# ActiveAdmin::Event.dispatch ActiveAdmin::Namespace::RegisterEvent, namespace
|
112
|
+
# yield(namespace) if block_given?
|
113
|
+
# namespace
|
114
|
+
#end
|
115
|
+
#
|
116
|
+
#alias_method :namespace, :find_or_create_namespace
|
117
|
+
#
|
118
|
+
## Register a page
|
119
|
+
##
|
120
|
+
## @param name [String] The page name
|
121
|
+
## @options [Hash] Accepts option :namespace.
|
122
|
+
## @&block The registration block.
|
123
|
+
##
|
124
|
+
#def register_page(name, options = {}, &block)
|
125
|
+
# namespace_name = extract_namespace_name(options)
|
126
|
+
# namespace = find_or_create_namespace(namespace_name)
|
127
|
+
# namespace.register_page(name, options, &block)
|
128
|
+
#end
|
129
|
+
#
|
130
|
+
## Stores if everything has been loaded or we need to reload
|
131
|
+
#@@loaded = false
|
132
|
+
#
|
133
|
+
## Returns true if all the configuration files have been loaded.
|
134
|
+
#def loaded?
|
135
|
+
# @@loaded
|
136
|
+
#end
|
137
|
+
#
|
138
|
+
## Removes all the controllers that were defined by registering
|
139
|
+
## resources for administration.
|
140
|
+
##
|
141
|
+
## We remove them, then load them on each request in development
|
142
|
+
## to allow for changes without having to restart the server.
|
143
|
+
#def unload!
|
144
|
+
# namespaces.values.each{|namespace| namespace.unload! }
|
145
|
+
# @@loaded = false
|
146
|
+
#end
|
147
|
+
#
|
148
|
+
## Loads all of the ruby files that are within the load path of
|
149
|
+
## ActiveAdmin.load_paths. This should load all of the administration
|
150
|
+
## UIs so that they are available for the router to proceed.
|
151
|
+
##
|
152
|
+
## The files are only loaded if we haven't already loaded all the files
|
153
|
+
## and they aren't marked for re-loading. To mark the files for re-loading
|
154
|
+
## you must first call ActiveAdmin.unload!
|
155
|
+
#def load!
|
156
|
+
# # No work to do if we've already loaded
|
157
|
+
# return false if loaded?
|
158
|
+
#
|
159
|
+
# # Load files
|
160
|
+
# files_in_load_path.each{|file| load file }
|
161
|
+
#
|
162
|
+
# # If no configurations, let's make sure you can still login
|
163
|
+
# load_default_namespace if namespaces.values.empty?
|
164
|
+
#
|
165
|
+
# # Load Menus
|
166
|
+
# namespaces.values.each{|namespace| namespace.load_menu! }
|
167
|
+
#
|
168
|
+
# # Dispatch an ActiveAdmin::Application::LoadEvent with the Application
|
169
|
+
# ActiveAdmin::Event.dispatch LoadEvent, self
|
170
|
+
#
|
171
|
+
# @@loaded = true
|
172
|
+
#end
|
173
|
+
#
|
174
|
+
## Returns ALL the files to load from all the load paths
|
175
|
+
#def files_in_load_path
|
176
|
+
# load_paths.flatten.compact.uniq.collect{|path| Dir["#{path}/**/*.rb"] }.flatten
|
177
|
+
#end
|
178
|
+
|
179
|
+
def router
|
180
|
+
@router ||= Router.new(self)
|
181
|
+
end
|
182
|
+
|
183
|
+
def routes(rails_router)
|
184
|
+
# Ensure that all the configurations (which define the routes)
|
185
|
+
# are all loaded
|
186
|
+
#load!
|
187
|
+
|
188
|
+
router.apply(rails_router)
|
189
|
+
end
|
190
|
+
|
191
|
+
#def load_default_namespace
|
192
|
+
# find_or_create_namespace(default_namespace)
|
193
|
+
#end
|
194
|
+
#
|
195
|
+
##
|
196
|
+
## Add before, around and after filters to each registered resource.
|
197
|
+
##
|
198
|
+
## eg:
|
199
|
+
##
|
200
|
+
## ActiveAdmin.before_filter :authenticate_admin!
|
201
|
+
##
|
202
|
+
#def before_filter(*args, &block)
|
203
|
+
# ResourceController.before_filter(*args, &block)
|
204
|
+
#end
|
205
|
+
#
|
206
|
+
#def skip_before_filter(*args, &block)
|
207
|
+
# ResourceController.skip_before_filter(*args, &block)
|
208
|
+
#end
|
209
|
+
#
|
210
|
+
#def after_filter(*args, &block)
|
211
|
+
# ResourceController.after_filter(*args, &block)
|
212
|
+
#end
|
213
|
+
#
|
214
|
+
#def around_filter(*args, &block)
|
215
|
+
# ResourceController.around_filter(*args, &block)
|
216
|
+
#end
|
217
|
+
#
|
218
|
+
## Helper method to add a dashboard section
|
219
|
+
#def dashboard_section(name, options = {}, &block)
|
220
|
+
# ActiveAdmin::Dashboards.add_section(name, options, &block)
|
221
|
+
#end
|
222
|
+
#
|
223
|
+
#private
|
224
|
+
|
225
|
+
def register_default_assets
|
226
|
+
register_stylesheet 'elrte.css', :media => 'all'
|
227
|
+
|
228
|
+
#if !ActiveAdmin.use_asset_pipeline?
|
229
|
+
register_javascript 'jquery.min.js'
|
230
|
+
register_javascript 'jquery-ui.min.js'
|
231
|
+
register_javascript 'jquery_ujs.js'
|
232
|
+
#end
|
233
|
+
|
234
|
+
register_javascript 'elrte.js'
|
235
|
+
end
|
236
|
+
|
237
|
+
#def extract_namespace_name(options)
|
238
|
+
# options.has_key?(:namespace) ? options[:namespace] : default_namespace
|
239
|
+
#end
|
240
|
+
#
|
241
|
+
## Since we're dealing with all our own file loading, we need
|
242
|
+
## to remove our paths from the ActiveSupport autoload paths.
|
243
|
+
## If not, file naming becomes very important and can cause clashes.
|
244
|
+
#def remove_active_admin_load_paths_from_rails_autoload_and_eager_load
|
245
|
+
# ActiveSupport::Dependencies.autoload_paths.reject!{|path| load_paths.include?(path) }
|
246
|
+
# # Don't eagerload our configs, we'll deal with them ourselves
|
247
|
+
# Rails.application.config.eager_load_paths = Rails.application.config.eager_load_paths.reject do |path|
|
248
|
+
# load_paths.include?(path)
|
249
|
+
# end
|
250
|
+
#end
|
251
|
+
#
|
252
|
+
#def attach_reloader
|
253
|
+
# ActiveAdmin::Reloader.new(Rails.application, self, Rails.version).attach!
|
254
|
+
#end
|
255
|
+
#
|
256
|
+
#
|
257
|
+
#def generate_stylesheets
|
258
|
+
# # This must be required after initialization
|
259
|
+
# require 'sass/plugin'
|
260
|
+
# require 'active_admin/sass/helpers'
|
261
|
+
#
|
262
|
+
# # Create our own asset pipeline in Rails 3.0
|
263
|
+
# if ActiveAdmin.use_asset_pipeline?
|
264
|
+
# # Add our mixins to the load path for SASS
|
265
|
+
# ::Sass::Engine::DEFAULT_OPTIONS[:load_paths] << File.expand_path("../../../app/assets/stylesheets", __FILE__)
|
266
|
+
# else
|
267
|
+
# require 'active_admin/sass/css_loader'
|
268
|
+
# ::Sass::Plugin.add_template_location(File.expand_path("../../../app/assets/stylesheets", __FILE__))
|
269
|
+
# ::Sass::Plugin.add_template_location(File.expand_path("../sass", __FILE__))
|
270
|
+
# end
|
271
|
+
#end
|
272
|
+
end
|
273
|
+
end
|
data/lib/elrte/engine.rb
ADDED
data/lib/elrte/router.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Elrte
|
2
|
+
class Router
|
3
|
+
|
4
|
+
def initialize(application)
|
5
|
+
@application = application
|
6
|
+
end
|
7
|
+
|
8
|
+
# Creates all the necessary routes for the Elrte configurations
|
9
|
+
#
|
10
|
+
# Use this within the routes.rb file:
|
11
|
+
#
|
12
|
+
# Application.routes.draw do |map|
|
13
|
+
# Elrte.routes(self)
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
def apply(router)
|
17
|
+
router.send('match', {'elfinder' => 'elfinder#connector', :as => 'elfinder_connector'})
|
18
|
+
#p @application.namespaces.values
|
19
|
+
#router.instance_exec(@application.namespaces.values) do |namespaces|
|
20
|
+
# namespaces.each do |namespace|
|
21
|
+
# match '/elfinder' => 'Elfinder#connector', :as => 'elfinder_connector'
|
22
|
+
# #if namespace.root?
|
23
|
+
# # match '/' => 'dashboard#index', :as => 'dashboard'
|
24
|
+
# #else
|
25
|
+
# # name = namespace.name
|
26
|
+
# # match name.to_s => "#{name}/dashboard#index", :as => "#{name.to_s}_dashboard"
|
27
|
+
# #end
|
28
|
+
# end
|
29
|
+
#end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Elrte
|
2
|
+
module Generators
|
3
|
+
class AssetsGenerator < Rails::Generators::Base
|
4
|
+
|
5
|
+
#class_option :bourbon, :type => :boolean, :default => true,
|
6
|
+
# :desc => "Generate Bourbon scss files if using Rails 3.0.x"
|
7
|
+
#
|
8
|
+
#class_option :jquery, :type => :boolean, :default => true,
|
9
|
+
# :desc => "Generate jQuery js files if using Rails 3.0.x"
|
10
|
+
|
11
|
+
def self.source_root
|
12
|
+
@_elrte_source_root ||= File.expand_path("../templates", __FILE__)
|
13
|
+
end
|
14
|
+
|
15
|
+
def install_assets
|
16
|
+
require 'rails'
|
17
|
+
require 'elrte'
|
18
|
+
|
19
|
+
if Elrte.use_asset_pipeline?
|
20
|
+
template '3.1/elrte.js', 'app/assets/javascripts/elrte.js'
|
21
|
+
template '3.1/elrte.css.scss', 'app/assets/stylesheets/elrte.css.scss'
|
22
|
+
else
|
23
|
+
#template '../../../../../app/assets/javascripts/active_admin/application.js', 'public/javascripts/active_admin.js'
|
24
|
+
#directory '../../../../../app/assets/images/active_admin', 'public/images/active_admin'
|
25
|
+
#generate "jquery:install --ui" if options.jquery?
|
26
|
+
#install_bourbon if options.bourbon?
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
#private
|
31
|
+
|
32
|
+
#def install_bourbon
|
33
|
+
# rake "bourbon:install"
|
34
|
+
# create_file "public/stylesheets/sass/_bourbon.scss", '@import "bourbon/bourbon"'
|
35
|
+
#end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
//= require elrte/base
|
2
|
+
|
3
|
+
/**
|
4
|
+
* You can easily create own toolbar,
|
5
|
+
* read how to: http://elrte.org/redmine/projects/elrte/wiki/Docs_EN#Toolbar
|
6
|
+
*/
|
7
|
+
|
8
|
+
jQuery(function($){
|
9
|
+
var opts = {
|
10
|
+
absoluteURLs: false,
|
11
|
+
cssClass : 'el-rte elrte-editor',
|
12
|
+
lang : 'en',
|
13
|
+
height : 420,
|
14
|
+
toolbar : 'ruby_elrte',
|
15
|
+
fmOpen : function(callback) {
|
16
|
+
$('<div id="my_elfinder" />').elfinder({
|
17
|
+
url : '/elfinder',
|
18
|
+
lang : 'en',
|
19
|
+
dialog : { width : 900, modal : true, title : 'elFinder - file manager for web', resizable: true },
|
20
|
+
closeOnEditorCallback : true,
|
21
|
+
editorCallback : callback
|
22
|
+
});
|
23
|
+
}
|
24
|
+
};
|
25
|
+
$('.editor').elrte(opts);
|
26
|
+
});
|