moxify 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +45 -0
- data/app/sweepers/page_sweeper.rb +55 -0
- data/app/views/admin/_head.html.erb +22 -0
- data/app/views/layouts/application.html.erb +19 -0
- data/app/views/shared/_site_bar.html.erb +18 -0
- data/config/routes.rb +45 -0
- data/lib/gemspec.rb +52 -0
- data/lib/moxify/dragonfly_quality_hook.rb +14 -0
- data/lib/moxify/url_tempfile.rb +17 -0
- data/lib/moxify.rb +23 -0
- data/public/stylesheets/refinery/moxify.css +29 -0
- data/public/stylesheets/refinery/site_bar.css +87 -0
- metadata +94 -0
data/.gitignore
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
*.gemspec
|
2
|
+
*.gem
|
3
|
+
|
4
|
+
# rcov generated
|
5
|
+
coverage
|
6
|
+
|
7
|
+
# rdoc generated
|
8
|
+
rdoc
|
9
|
+
|
10
|
+
# yard generated
|
11
|
+
doc
|
12
|
+
.yardoc
|
13
|
+
|
14
|
+
# bundler
|
15
|
+
.bundle
|
16
|
+
|
17
|
+
# jeweler generated
|
18
|
+
pkg
|
19
|
+
|
20
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
21
|
+
#
|
22
|
+
# * Create a file at ~/.gitignore
|
23
|
+
# * Include files you want ignored
|
24
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
25
|
+
#
|
26
|
+
# After doing this, these files will be ignored in all your git projects,
|
27
|
+
# saving you from having to 'pollute' every project you touch with them
|
28
|
+
#
|
29
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
30
|
+
#
|
31
|
+
# For MacOS:
|
32
|
+
#
|
33
|
+
.DS_Store
|
34
|
+
#
|
35
|
+
# For TextMate
|
36
|
+
*.tmproj
|
37
|
+
tmtags
|
38
|
+
#
|
39
|
+
# For emacs:
|
40
|
+
#*~
|
41
|
+
#\#*
|
42
|
+
#.\#*
|
43
|
+
#
|
44
|
+
# For vim:
|
45
|
+
#*.swp
|
@@ -0,0 +1,55 @@
|
|
1
|
+
class PageSweeper < ActionController::Caching::Sweeper
|
2
|
+
observe Page, Slug
|
3
|
+
|
4
|
+
def after_save model
|
5
|
+
expire_cache model
|
6
|
+
end
|
7
|
+
|
8
|
+
def after_destroy model
|
9
|
+
expire_cache model
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def expire_cache model
|
15
|
+
case model.class.name.to_s
|
16
|
+
when "Page"
|
17
|
+
# only expire latest slug
|
18
|
+
# in case title changes, it will trigger the expire_slug function from the observer
|
19
|
+
expire_page "/#{model.slug.name}"
|
20
|
+
|
21
|
+
# expire all cache if we change root page
|
22
|
+
expire_dir nil if (model.parent_id.blank?)
|
23
|
+
when "Slug"
|
24
|
+
# expire from parent level down
|
25
|
+
expire_parent_and_descendants model.name
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
# expire the parent directory and page
|
32
|
+
def expire_parent_and_descendants slug
|
33
|
+
expire_page parent_slug(slug)
|
34
|
+
expire_dir parent_slug(slug)
|
35
|
+
end
|
36
|
+
|
37
|
+
# expire a whole cache directory
|
38
|
+
def expire_dir dir
|
39
|
+
cache_dir = ActionController::Base.page_cache_directory
|
40
|
+
FileUtils.rm_rf Dir.glob("#{cache_dir}#{dir}") rescue Errno::ENOENT
|
41
|
+
Rails.logger.info("Removed cache dir: #{cache_dir}#{dir}")
|
42
|
+
end
|
43
|
+
|
44
|
+
# why not split, pop and rejoin?
|
45
|
+
def parent_slug slug
|
46
|
+
if slug.sluggable_type == "Page"
|
47
|
+
if slug.sluggable.root?
|
48
|
+
slug
|
49
|
+
else
|
50
|
+
slug.sluggable.parent.slug.name
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<head>
|
2
|
+
<meta charset='<%= ::Refinery::Application.config.encoding %>' />
|
3
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
4
|
+
<%= yield :meta %>
|
5
|
+
<title><%= RefinerySetting.find_or_set(:site_name, 'Company Name') -%> - Admin</title>
|
6
|
+
<%= csrf_meta_tag %>
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag 'refinery/site_bar',
|
9
|
+
'refinery/refinery',
|
10
|
+
'refinery/moxify',
|
11
|
+
'refinery/ui',
|
12
|
+
'refinery/submenu',
|
13
|
+
'refinery/tooltips',
|
14
|
+
'wymeditor/skins/refinery/skin',
|
15
|
+
:cache => ("cache/refinery" if Rails.root.writable? and
|
16
|
+
RefinerySetting.find_or_set(:use_resource_caching, true) and
|
17
|
+
request.env['HTTP_USER_AGENT'] !~ /MSIE/) -%>
|
18
|
+
|
19
|
+
<%= yield :stylesheets %>
|
20
|
+
|
21
|
+
<%= javascript_include_tag 'modernizr-min' %>
|
22
|
+
</head>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<%= render :partial => "/shared/html_tag" %>
|
3
|
+
<%= render :partial => "/shared/head" %>
|
4
|
+
<body>
|
5
|
+
<%= render :partial => "/shared/ie6check" if request.env['HTTP_USER_AGENT'] =~ /MSIE/ -%>
|
6
|
+
<div id="page_container">
|
7
|
+
<header>
|
8
|
+
<%= render :partial => "/shared/header" -%>
|
9
|
+
</header>
|
10
|
+
<section id='page'>
|
11
|
+
<%= yield %>
|
12
|
+
</section>
|
13
|
+
<footer>
|
14
|
+
<%= render :partial => "/shared/footer" -%>
|
15
|
+
</footer>
|
16
|
+
</div>
|
17
|
+
<%= render :partial => "/shared/javascripts" %>
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% if refinery_user? %>
|
2
|
+
<% unless admin? # all required JS included by backend. %>
|
3
|
+
<% content_for :stylesheets, stylesheet_link_tag('refinery/site_bar') unless !!local_assigns[:exclude_css] %>
|
4
|
+
<%= yield(:stylesheets) unless local_assigns[:head] or local_assigns[:exclude_css] %>
|
5
|
+
<% end -%>
|
6
|
+
<div id='site_bar'>
|
7
|
+
<div id='site_bar_content' class='clearfix'>
|
8
|
+
<div id='site_bar_branding'>
|
9
|
+
<span id='site_bar_company_name'>
|
10
|
+
<%= RefinerySetting.find_or_set(:site_name, 'Company Name') %>
|
11
|
+
</span>
|
12
|
+
|
13
|
+
<%= link_to t('.log_out', site_bar_translate_locale_args),
|
14
|
+
destroy_user_session_path, :id => 'logout' %>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
Refinery::Application.routes.draw do
|
2
|
+
#match '/admin(/*path)' => 'admin/base#error_404'
|
3
|
+
#match '/admin' => 'admin/dashboard#index'
|
4
|
+
get 'admin', :to => 'admin/dashboard#index', :as => :refinery_root
|
5
|
+
get 'admin', :to => 'admin/dashboard#index', :as => :user_root
|
6
|
+
|
7
|
+
scope :except => :show do
|
8
|
+
namespace :admin do
|
9
|
+
|
10
|
+
# refinerycms-pages
|
11
|
+
resources :pages do
|
12
|
+
post :update_positions, :on => :collection
|
13
|
+
end
|
14
|
+
|
15
|
+
resources :pages_dialogs, :only => [] do
|
16
|
+
collection do
|
17
|
+
get :link_to
|
18
|
+
get :test_url
|
19
|
+
get :test_email
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
resources :page_parts, :only => [:new, :create, :destroy]
|
24
|
+
|
25
|
+
# refinerycms-images
|
26
|
+
resources :images
|
27
|
+
|
28
|
+
# refinerycms-authentication
|
29
|
+
resources :users
|
30
|
+
|
31
|
+
# refinerycms-resources
|
32
|
+
resources :resources
|
33
|
+
|
34
|
+
# refinerycms-settings
|
35
|
+
resources :settings,
|
36
|
+
:except => :show,
|
37
|
+
:as => :refinery_settings,
|
38
|
+
:controller => :refinery_settings
|
39
|
+
|
40
|
+
# refinerycms-dashboard
|
41
|
+
root :to => 'dashboard#index'
|
42
|
+
resources :dialogs, :only => :show
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/gemspec.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
gempath = Pathname.new(File.expand_path('../../', __FILE__))
|
4
|
+
|
5
|
+
files = %w( Gemfile *.md **/**/{*,.rspec,.gitignore,.yardopts} ).map { |file| Pathname.glob(file) }.flatten
|
6
|
+
rejection_patterns = [
|
7
|
+
"^public/system",
|
8
|
+
"^config/(application|boot|environment).rb$",
|
9
|
+
"^config/initializers(\/.*\.rb)?$",
|
10
|
+
"^config/(database|i18n\-js).yml$",
|
11
|
+
"^lib\/gemspec\.rb",
|
12
|
+
".*\/cache\/",
|
13
|
+
"^script\/*",
|
14
|
+
"^vendor\/plugins\/?$",
|
15
|
+
"(^log|\.log)$",
|
16
|
+
"\.rbc$",
|
17
|
+
"^tmp(|/.+?)$",
|
18
|
+
".gem$",
|
19
|
+
"^doc($|\/)"
|
20
|
+
]
|
21
|
+
|
22
|
+
files.reject! do |f|
|
23
|
+
!f.exist? or (f.directory? and f.children.empty?) =~ %r{(#{rejection_patterns.join(')|(')})}
|
24
|
+
end
|
25
|
+
|
26
|
+
gemspec = <<EOF
|
27
|
+
# DO NOT EDIT THIS FILE DIRECTLY! Instead, use lib/gemspec.rb to generate it.
|
28
|
+
|
29
|
+
Gem::Specification.new do |s|
|
30
|
+
s.name = %q{#{gemname = 'moxify'}}
|
31
|
+
s.version = '0.1.3'
|
32
|
+
s.description = 'A blanket full of toy cars for Refinery CMS'
|
33
|
+
s.date = %q{#{Time.now.strftime('%Y-%m-%d')}}
|
34
|
+
s.summary = 'My port of Refinery CMS'
|
35
|
+
s.email = %q{mail@bitflut.com}
|
36
|
+
s.homepage = %q{http://bitflut.com}
|
37
|
+
s.authors = ['Marian André']
|
38
|
+
s.license = %q{MIT}
|
39
|
+
s.require_paths = %w(lib)
|
40
|
+
s.files = Dir['lib/**/*', 'config/**/*', 'app/**/*', 'public/**/*']
|
41
|
+
|
42
|
+
s.add_dependency 'refinerycms', '~> 0.9.9.10'
|
43
|
+
|
44
|
+
s.files = [
|
45
|
+
'#{files.sort.join("',\n '")}'
|
46
|
+
]
|
47
|
+
end
|
48
|
+
EOF
|
49
|
+
|
50
|
+
|
51
|
+
(gemfile = gempath.join("#{gemname}.gemspec")).open('w') {|f| f.puts(gemspec)}
|
52
|
+
puts `cd #{gempath} && gem build #{gemfile}` if ARGV.any?{|a| a == "BUILD=true"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# This is a hook into Dragonfly's ImageMagick processor class
|
2
|
+
# It makes sure quality is 100 for thumbnail generation
|
3
|
+
module Dragonfly
|
4
|
+
module Processing
|
5
|
+
class ImageMagickProcessor
|
6
|
+
|
7
|
+
def convert(temp_object, args='', format=nil)
|
8
|
+
args = "#{args} -quality 100" unless args.blank?
|
9
|
+
format ? [super, {:format => format.to_sym}] : super
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class URLTempfile < Tempfile
|
2
|
+
|
3
|
+
def initialize(url)
|
4
|
+
@url = URI.parse(url)
|
5
|
+
|
6
|
+
begin
|
7
|
+
super('url', Dir.tmpdir)
|
8
|
+
|
9
|
+
Net::HTTP.start(@url.host) do |http|
|
10
|
+
resp = http.get(@url.path)
|
11
|
+
self.write resp.body
|
12
|
+
end
|
13
|
+
ensure
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
data/lib/moxify.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'refinery'
|
2
|
+
require 'moxify/url_tempfile'
|
3
|
+
|
4
|
+
module Refinery
|
5
|
+
module Moxify
|
6
|
+
class Engine < Rails::Engine
|
7
|
+
initializer "static assets" do |app|
|
8
|
+
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
9
|
+
end
|
10
|
+
|
11
|
+
initializer "require dragonfly hook" do |app|
|
12
|
+
require 'moxify/dragonfly_quality_hook'
|
13
|
+
end
|
14
|
+
|
15
|
+
::Refinery::Plugin.register do |plugin|
|
16
|
+
plugin.name ="moxify"
|
17
|
+
plugin.version = "0.1.3"
|
18
|
+
plugin.hide_from_menu = true
|
19
|
+
plugin.always_allow_access = true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
div#site_bar {
|
2
|
+
background: #fff;
|
3
|
+
border-bottom: 2px solid #000;
|
4
|
+
}
|
5
|
+
|
6
|
+
div#site_bar * {
|
7
|
+
color: black;
|
8
|
+
}
|
9
|
+
|
10
|
+
div#site_bar a {
|
11
|
+
border-bottom: 1px dotted black;
|
12
|
+
}
|
13
|
+
|
14
|
+
div#site_bar #site_bar_company_name {
|
15
|
+
font-weight: bold;
|
16
|
+
}
|
17
|
+
|
18
|
+
body {
|
19
|
+
background: #303030;
|
20
|
+
}
|
21
|
+
|
22
|
+
#menu a.active, #menu a:hover, #menu a:focus {
|
23
|
+
color: #000;
|
24
|
+
font-weight: bold;
|
25
|
+
}
|
26
|
+
|
27
|
+
#menu, header .jcarousel-container {
|
28
|
+
width: 100% !important;
|
29
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
div#site_bar, div#site_bar * {
|
2
|
+
color: white;
|
3
|
+
font-family: Arial;
|
4
|
+
font-size: 14px;
|
5
|
+
font-weight: normal;
|
6
|
+
}
|
7
|
+
#editor_switch, div#site_bar_branding, adiv#site_bar_refinery_cms_logo {
|
8
|
+
position: absolute;
|
9
|
+
}
|
10
|
+
#editor_switch {
|
11
|
+
left: 0px;
|
12
|
+
}
|
13
|
+
div#site_bar_branding {
|
14
|
+
right: 0px;
|
15
|
+
}
|
16
|
+
div#site_bar div#site_bar_company_name {
|
17
|
+
font-weight: bold;
|
18
|
+
}
|
19
|
+
div#site_bar div#site_bar_branding a {
|
20
|
+
font-weight: normal;
|
21
|
+
}
|
22
|
+
div#site_bar div#site_bar_branding a#logout {
|
23
|
+
margin-left: 12px;
|
24
|
+
}
|
25
|
+
div#site_bar * {
|
26
|
+
line-height: 47px;
|
27
|
+
}
|
28
|
+
div#site_bar {
|
29
|
+
height: 47px;
|
30
|
+
background: #900;
|
31
|
+
padding: 0px;
|
32
|
+
}
|
33
|
+
div#site_bar a {
|
34
|
+
border-bottom: 1px dotted white;
|
35
|
+
text-decoration: none;
|
36
|
+
}
|
37
|
+
div#site_bar a:hover {
|
38
|
+
border-bottom: 1px solid white;
|
39
|
+
}
|
40
|
+
div#site_bar_content {
|
41
|
+
height:47px;
|
42
|
+
position: relative;
|
43
|
+
}
|
44
|
+
adiv#site_bar_refinery_cms_logo {
|
45
|
+
left: 44.5%;
|
46
|
+
border-bottom: none;
|
47
|
+
line-height: 29px;
|
48
|
+
height: 29px;
|
49
|
+
margin-top: 9px;
|
50
|
+
overflow: hidden;
|
51
|
+
}
|
52
|
+
adiv#site_bar_refinery_cms_logo:hover {
|
53
|
+
border-bottom: none;
|
54
|
+
opacity: 1;
|
55
|
+
}
|
56
|
+
adiv#site_bar_refinery_cms_logo:hover img {
|
57
|
+
margin-top: -29px;
|
58
|
+
}
|
59
|
+
#editor_switch a, #editor_switch a:hover {
|
60
|
+
color: white;
|
61
|
+
background: #e7682c url('/images/refinery/orange_button.png') repeat-x;
|
62
|
+
border-bottom: 0px none;
|
63
|
+
padding: 4px 14px;
|
64
|
+
border: 1px solid #fca87f;
|
65
|
+
height: 24px;
|
66
|
+
line-height: 24px;
|
67
|
+
cursor: pointer;
|
68
|
+
}
|
69
|
+
#editor_switch span {
|
70
|
+
border: 1px solid #0280c7;
|
71
|
+
height: 26px;
|
72
|
+
line-height: 26px;
|
73
|
+
margin-top: 9px;
|
74
|
+
display: block;
|
75
|
+
cursor: pointer;
|
76
|
+
}
|
77
|
+
|
78
|
+
#editor_switch a, #editor_switch span {
|
79
|
+
border-radius: 6px;
|
80
|
+
-moz-border-radius: 6px;
|
81
|
+
-webkit-border-radius: 6px;
|
82
|
+
}
|
83
|
+
|
84
|
+
.ie7 div#site_bar #editor_switch a {
|
85
|
+
height: 26px;
|
86
|
+
line-height: 26px;
|
87
|
+
}
|
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: moxify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- "Marian Andr\xC3\xA9"
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-03-26 00:00:00 +01:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: refinerycms
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 55
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 9
|
33
|
+
- 9
|
34
|
+
- 10
|
35
|
+
version: 0.9.9.10
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
38
|
+
description: A blanket full of toy cars for Refinery CMS
|
39
|
+
email: mail@bitflut.com
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files: []
|
45
|
+
|
46
|
+
files:
|
47
|
+
- .gitignore
|
48
|
+
- app/sweepers/page_sweeper.rb
|
49
|
+
- app/views/admin/_head.html.erb
|
50
|
+
- app/views/layouts/application.html.erb
|
51
|
+
- app/views/shared/_site_bar.html.erb
|
52
|
+
- config/routes.rb
|
53
|
+
- lib/gemspec.rb
|
54
|
+
- lib/moxify/dragonfly_quality_hook.rb
|
55
|
+
- lib/moxify/url_tempfile.rb
|
56
|
+
- lib/moxify.rb
|
57
|
+
- public/stylesheets/refinery/moxify.css
|
58
|
+
- public/stylesheets/refinery/site_bar.css
|
59
|
+
has_rdoc: true
|
60
|
+
homepage: http://bitflut.com
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
hash: 3
|
83
|
+
segments:
|
84
|
+
- 0
|
85
|
+
version: "0"
|
86
|
+
requirements: []
|
87
|
+
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 1.6.2
|
90
|
+
signing_key:
|
91
|
+
specification_version: 3
|
92
|
+
summary: My port of Refinery CMS
|
93
|
+
test_files: []
|
94
|
+
|