radiant-dumb_user_interface-extension 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +3 -0
- data/Rakefile +117 -0
- data/dumb_user_interface_extension.rb +26 -0
- data/lib/radiant-dumb_user_interface-extension/pages_controller_extension.rb +12 -0
- data/lib/radiant-dumb_user_interface-extension/version.rb +3 -0
- data/lib/radiant-dumb_user_interface-extension.rb +2 -0
- data/lib/tasks/dumb_user_interface_extension_tasks.rake +55 -0
- data/public/javascripts/admin/extensions/dumb_user_interface/dumb_interface.js +13 -0
- data/radiant-dumb_user_interface-extension.gemspec +24 -0
- metadata +76 -0
data/README
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
# Determine where the RSpec plugin is by loading the boot
|
2
|
+
unless defined? RADIANT_ROOT
|
3
|
+
ENV["RAILS_ENV"] = "test"
|
4
|
+
case
|
5
|
+
when ENV["RADIANT_ENV_FILE"]
|
6
|
+
require File.dirname(ENV["RADIANT_ENV_FILE"]) + "/boot"
|
7
|
+
when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
|
8
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot"
|
9
|
+
else
|
10
|
+
require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'rake'
|
15
|
+
require 'rake/rdoctask'
|
16
|
+
require 'rake/testtask'
|
17
|
+
|
18
|
+
rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
|
19
|
+
$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
|
20
|
+
require 'spec/rake/spectask'
|
21
|
+
require 'cucumber'
|
22
|
+
require 'cucumber/rake/task'
|
23
|
+
|
24
|
+
# Cleanup the RADIANT_ROOT constant so specs will load the environment
|
25
|
+
Object.send(:remove_const, :RADIANT_ROOT)
|
26
|
+
|
27
|
+
extension_root = File.expand_path(File.dirname(__FILE__))
|
28
|
+
|
29
|
+
task :default => :spec
|
30
|
+
task :stats => "spec:statsetup"
|
31
|
+
|
32
|
+
desc "Run all specs in spec directory"
|
33
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
34
|
+
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
35
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
36
|
+
end
|
37
|
+
|
38
|
+
task :features => 'spec:integration'
|
39
|
+
|
40
|
+
namespace :spec do
|
41
|
+
desc "Run all specs in spec directory with RCov"
|
42
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
43
|
+
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
44
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
45
|
+
t.rcov = true
|
46
|
+
t.rcov_opts = ['--exclude', 'spec', '--rails']
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "Print Specdoc for all specs"
|
50
|
+
Spec::Rake::SpecTask.new(:doc) do |t|
|
51
|
+
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
52
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
53
|
+
end
|
54
|
+
|
55
|
+
[:models, :controllers, :views, :helpers].each do |sub|
|
56
|
+
desc "Run the specs under spec/#{sub}"
|
57
|
+
Spec::Rake::SpecTask.new(sub) do |t|
|
58
|
+
t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
|
59
|
+
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "Run the Cucumber features"
|
64
|
+
Cucumber::Rake::Task.new(:integration) do |t|
|
65
|
+
t.fork = true
|
66
|
+
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
|
67
|
+
# t.feature_pattern = "#{extension_root}/features/**/*.feature"
|
68
|
+
t.profile = "default"
|
69
|
+
end
|
70
|
+
|
71
|
+
# Setup specs for stats
|
72
|
+
task :statsetup do
|
73
|
+
require 'code_statistics'
|
74
|
+
::STATS_DIRECTORIES << %w(Model\ specs spec/models)
|
75
|
+
::STATS_DIRECTORIES << %w(View\ specs spec/views)
|
76
|
+
::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers)
|
77
|
+
::STATS_DIRECTORIES << %w(Helper\ specs spec/views)
|
78
|
+
::CodeStatistics::TEST_TYPES << "Model specs"
|
79
|
+
::CodeStatistics::TEST_TYPES << "View specs"
|
80
|
+
::CodeStatistics::TEST_TYPES << "Controller specs"
|
81
|
+
::CodeStatistics::TEST_TYPES << "Helper specs"
|
82
|
+
::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
|
83
|
+
end
|
84
|
+
|
85
|
+
namespace :db do
|
86
|
+
namespace :fixtures do
|
87
|
+
desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
|
88
|
+
task :load => :environment do
|
89
|
+
require 'active_record/fixtures'
|
90
|
+
ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
|
91
|
+
(ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
|
92
|
+
Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
desc 'Generate documentation for the dumb_user_interface extension.'
|
100
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
101
|
+
rdoc.rdoc_dir = 'rdoc'
|
102
|
+
rdoc.title = 'DumbUserInterfaceExtension'
|
103
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
104
|
+
rdoc.rdoc_files.include('README')
|
105
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
106
|
+
end
|
107
|
+
|
108
|
+
# For extensions that are in transition
|
109
|
+
desc 'Test the dumb_user_interface extension.'
|
110
|
+
Rake::TestTask.new(:test) do |t|
|
111
|
+
t.libs << 'lib'
|
112
|
+
t.pattern = 'test/**/*_test.rb'
|
113
|
+
t.verbose = true
|
114
|
+
end
|
115
|
+
|
116
|
+
# Load any custom rakefiles for extension
|
117
|
+
Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Uncomment this if you reference any of your controllers in activate
|
2
|
+
# require_dependency 'application_controller'
|
3
|
+
require 'radiant-dumb_user_interface-extension/version'
|
4
|
+
require 'radiant-dumb_user_interface-extension/pages_controller_extension'
|
5
|
+
|
6
|
+
class DumbUserInterfaceExtension < Radiant::Extension
|
7
|
+
version RadiantDumbUserInterfaceExtension::VERSION
|
8
|
+
description "Adds dumb_user_interface to Radiant."
|
9
|
+
url "http://github.com/jomz/radiant-dumb_user_interface-extension"
|
10
|
+
|
11
|
+
# extension_config do |config|
|
12
|
+
# config.gem 'some-awesome-gem
|
13
|
+
# config.after_initialize do
|
14
|
+
# run_something
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
|
18
|
+
# See your config/routes.rb file in this extension to define custom routes
|
19
|
+
|
20
|
+
def activate
|
21
|
+
Admin::PagesController.send :include, RadiantDumbUserInterfaceExtension::PagesControllerExtension
|
22
|
+
# tab 'Content' do
|
23
|
+
# add_item "Dumb User Interface", "/admin/dumb_user_interface", :after => "Pages"
|
24
|
+
# end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module RadiantDumbUserInterfaceExtension
|
2
|
+
module PagesControllerExtension
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
base.before_filter :load_interface_js, :only => [:new, :edit]
|
6
|
+
end
|
7
|
+
|
8
|
+
def load_interface_js
|
9
|
+
include_javascript "admin/extensions/dumb_user_interface/dumb_interface" unless current_user.admin?
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
namespace :radiant do
|
2
|
+
namespace :extensions do
|
3
|
+
namespace :dumb_user_interface do
|
4
|
+
|
5
|
+
desc "Runs the migration of the Dumb User Interface extension"
|
6
|
+
task :migrate => :environment do
|
7
|
+
require 'radiant/extension_migrator'
|
8
|
+
if ENV["VERSION"]
|
9
|
+
DumbUserInterfaceExtension.migrator.migrate(ENV["VERSION"].to_i)
|
10
|
+
Rake::Task['db:schema:dump'].invoke
|
11
|
+
else
|
12
|
+
DumbUserInterfaceExtension.migrator.migrate
|
13
|
+
Rake::Task['db:schema:dump'].invoke
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Copies public assets of the Dumb User Interface to the instance public/ directory."
|
18
|
+
task :update => :environment do
|
19
|
+
is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
|
20
|
+
puts "Copying assets from DumbUserInterfaceExtension"
|
21
|
+
Dir[DumbUserInterfaceExtension.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
|
22
|
+
path = file.sub(DumbUserInterfaceExtension.root, '')
|
23
|
+
directory = File.dirname(path)
|
24
|
+
mkdir_p RAILS_ROOT + directory, :verbose => false
|
25
|
+
cp file, RAILS_ROOT + path, :verbose => false
|
26
|
+
end
|
27
|
+
unless DumbUserInterfaceExtension.root.starts_with? RAILS_ROOT # don't need to copy vendored tasks
|
28
|
+
puts "Copying rake tasks from DumbUserInterfaceExtension"
|
29
|
+
local_tasks_path = File.join(RAILS_ROOT, %w(lib tasks))
|
30
|
+
mkdir_p local_tasks_path, :verbose => false
|
31
|
+
Dir[File.join DumbUserInterfaceExtension.root, %w(lib tasks *.rake)].each do |file|
|
32
|
+
cp file, local_tasks_path, :verbose => false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "Syncs all available translations for this ext to the English ext master"
|
38
|
+
task :sync => :environment do
|
39
|
+
# The main translation root, basically where English is kept
|
40
|
+
language_root = DumbUserInterfaceExtension.root + "/config/locales"
|
41
|
+
words = TranslationSupport.get_translation_keys(language_root)
|
42
|
+
|
43
|
+
Dir["#{language_root}/*.yml"].each do |filename|
|
44
|
+
next if filename.match('_available_tags')
|
45
|
+
basename = File.basename(filename, '.yml')
|
46
|
+
puts "Syncing #{basename}"
|
47
|
+
(comments, other) = TranslationSupport.read_file(filename, basename)
|
48
|
+
words.each { |k,v| other[k] ||= words[k] } # Initializing hash variable as empty if it does not exist
|
49
|
+
other.delete_if { |k,v| !words[k] } # Remove if not defined in en.yml
|
50
|
+
TranslationSupport.write_file(filename, basename, comments, other)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
document.observe("dom:loaded", function() {
|
2
|
+
$$("div.part p select").select(function(el) { return /filter_id/.test(el.name) }).invoke("hide")
|
3
|
+
$$("div.part p label").select(function(el) { return /filter_id/.test(el.readAttribute("for")) }).invoke("hide")
|
4
|
+
|
5
|
+
$$("div.part .reference_links").invoke("hide")
|
6
|
+
|
7
|
+
$$("select#page_class_name").first().up("p").hide()
|
8
|
+
$$("select#page_layout_id").first().up("p").hide()
|
9
|
+
|
10
|
+
$$("select#page_status_id option").select(function(el) { return ![1,100].include(el.value) }).invoke("remove")
|
11
|
+
|
12
|
+
$$(".drawer_contents td.actions").invoke("hide")
|
13
|
+
})
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "radiant-dumb_user_interface-extension/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "radiant-dumb_user_interface-extension"
|
7
|
+
s.version = RadiantDumbUserInterfaceExtension::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Benny Degezelle"]
|
10
|
+
s.email = ["benny@gorilla-webdesign.be"]
|
11
|
+
s.homepage = "http://github.com/jomz/radiant-dumb_user_interface-extension"
|
12
|
+
s.summary = %q{Dumb User Interface for Radiant CMS}
|
13
|
+
s.description = %q{Makes Radiant better by adding dumb_user_interface!}
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
s.post_install_message = %{
|
21
|
+
Add this to your radiant project with:
|
22
|
+
config.gem 'radiant-dumb_user_interface-extension', :version => '#{RadiantDumbUserInterfaceExtension::VERSION}'
|
23
|
+
}
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: radiant-dumb_user_interface-extension
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Benny Degezelle
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-03-31 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Makes Radiant better by adding dumb_user_interface!
|
23
|
+
email:
|
24
|
+
- benny@gorilla-webdesign.be
|
25
|
+
executables: []
|
26
|
+
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files: []
|
30
|
+
|
31
|
+
files:
|
32
|
+
- README
|
33
|
+
- Rakefile
|
34
|
+
- dumb_user_interface_extension.rb
|
35
|
+
- lib/radiant-dumb_user_interface-extension.rb
|
36
|
+
- lib/radiant-dumb_user_interface-extension/pages_controller_extension.rb
|
37
|
+
- lib/radiant-dumb_user_interface-extension/version.rb
|
38
|
+
- lib/tasks/dumb_user_interface_extension_tasks.rake
|
39
|
+
- public/javascripts/admin/extensions/dumb_user_interface/dumb_interface.js
|
40
|
+
- radiant-dumb_user_interface-extension.gemspec
|
41
|
+
has_rdoc: true
|
42
|
+
homepage: http://github.com/jomz/radiant-dumb_user_interface-extension
|
43
|
+
licenses: []
|
44
|
+
|
45
|
+
post_install_message: "\n Add this to your radiant project with:\n config.gem 'radiant-dumb_user_interface-extension', :version => '1.0.0'\n "
|
46
|
+
rdoc_options: []
|
47
|
+
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
requirements: []
|
69
|
+
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 1.3.7
|
72
|
+
signing_key:
|
73
|
+
specification_version: 3
|
74
|
+
summary: Dumb User Interface for Radiant CMS
|
75
|
+
test_files: []
|
76
|
+
|