refinerycms-stylesheets 1.0.2
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/app/controllers/admin/stylesheets_controller.rb +8 -0
- data/app/controllers/stylesheets_controller.rb +30 -0
- data/app/models/stylesheet.rb +59 -0
- data/app/views/admin/pages/tabs/stylesheets/_index.html.haml +4 -0
- data/app/views/admin/pages/tabs/stylesheets/_stylesheet_picker.html.haml +26 -0
- data/app/views/admin/stylesheets/_actions.html.erb +28 -0
- data/app/views/admin/stylesheets/_form.html.haml +36 -0
- data/app/views/admin/stylesheets/_records.html.erb +18 -0
- data/app/views/admin/stylesheets/_sortable_list.html.erb +7 -0
- data/app/views/admin/stylesheets/_stylesheet.html.erb +18 -0
- data/app/views/admin/stylesheets/_stylesheets.html.erb +2 -0
- data/app/views/admin/stylesheets/edit.html.haml +4 -0
- data/app/views/admin/stylesheets/index.html.erb +10 -0
- data/app/views/admin/stylesheets/new.html.haml +4 -0
- data/app/views/stylesheets/index.html.erb +11 -0
- data/app/views/stylesheets/show.html.erb +33 -0
- data/config/locales/en.yml +31 -0
- data/config/locales/lolcat.yml +25 -0
- data/config/locales/nb.yml +21 -0
- data/config/locales/nl.yml +21 -0
- data/config/routes.rb +11 -0
- data/lib/generators/refinerycms_stylesheets_generator.rb +6 -0
- data/lib/refinery/stylesheets/dragonfly.rb +47 -0
- data/lib/refinerycms-stylesheets.rb +63 -0
- data/lib/tasks/stylesheets.rake +13 -0
- metadata +91 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
class StylesheetsController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :find_all_stylesheets
|
4
|
+
before_filter :find_page
|
5
|
+
|
6
|
+
def index
|
7
|
+
# you can use meta fields from your model instead (e.g. browser_title)
|
8
|
+
# by swapping @page for @stylesheet in the line below:
|
9
|
+
present(@page)
|
10
|
+
end
|
11
|
+
|
12
|
+
def show
|
13
|
+
@stylesheet = Stylesheet.find(params[:id])
|
14
|
+
|
15
|
+
# you can use meta fields from your model instead (e.g. browser_title)
|
16
|
+
# by swapping @page for @stylesheet in the line below:
|
17
|
+
present(@page)
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
def find_all_stylesheets
|
23
|
+
@stylesheets = Stylesheet.order('position ASC')
|
24
|
+
end
|
25
|
+
|
26
|
+
def find_page
|
27
|
+
@page = Page.where(:link_url => "/stylesheets").first
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class Stylesheet < ActiveRecord::Base
|
2
|
+
|
3
|
+
has_and_belongs_to_many :pages
|
4
|
+
|
5
|
+
acts_as_indexed :fields => [:name, :content]
|
6
|
+
|
7
|
+
validates :name, :presence => true, :uniqueness => true
|
8
|
+
validates :css_type, :presence => true
|
9
|
+
validates :content, :presence => true
|
10
|
+
|
11
|
+
before_save :generate_css_file
|
12
|
+
|
13
|
+
RESOURCES_DIR = ENV["HEROKU_RACK"].blank? ? Rails.root.join("public") : "tmp"
|
14
|
+
STYLESHEETS_DIR = ENV["HEROKU_RACK"].blank? ? File.join("system", "stylesheets").to_s : File.join("stylesheets").to_s
|
15
|
+
|
16
|
+
def relative_path
|
17
|
+
File.join("/#{ STYLESHEETS_DIR}", "#{self.name}.css").to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
protected
|
21
|
+
|
22
|
+
def generate_css_file
|
23
|
+
css = self.content
|
24
|
+
|
25
|
+
if self.css_type == 'sass'
|
26
|
+
begin
|
27
|
+
sass_engine = Sass::Engine.new(css)
|
28
|
+
Rails.logger.error("css=#{css}")
|
29
|
+
css = sass_engine.render
|
30
|
+
rescue Sass::SyntaxError => se
|
31
|
+
|
32
|
+
#the line number the exception gives is always incorrect, this formula adjusts it
|
33
|
+
line_number = (se.sass_line/2).to_i + 1 if se.sass_line
|
34
|
+
|
35
|
+
errors.add(:base, "Line #{line_number}: #{ se.message }")
|
36
|
+
Rails.logger.error(se.backtrace.inspect)
|
37
|
+
return false
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
unless css.blank?
|
43
|
+
|
44
|
+
output_dir = File.join(RESOURCES_DIR, STYLESHEETS_DIR)
|
45
|
+
|
46
|
+
::FileUtils.mkdir(output_dir) unless File.directory?(output_dir)
|
47
|
+
|
48
|
+
File.open(File.join(output_dir, "#{ self.name}.css"), 'w') {|f| f.write(css) }
|
49
|
+
return true
|
50
|
+
else
|
51
|
+
errors.add(:base, "Unable to generate the CSS file. Verify that your #{ self.css_type } syntax is correct.")
|
52
|
+
return false
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,4 @@
|
|
1
|
+
= content_for :stylesheets, stylesheet_link_tag('stylesheets-engine.css')
|
2
|
+
|
3
|
+
%section#stylesheet-picker
|
4
|
+
= render :partial => 'admin/pages/tabs/stylesheets/stylesheet_picker', :locals => { :page_stylesheets => @page.stylesheets, :all_stylesheets => Stylesheet.all - @page.stylesheets }
|
@@ -0,0 +1,26 @@
|
|
1
|
+
= content_for :after_javascript_libraries, javascript_include_tag('jquery.dualListBox-1.3.min.js','stylesheet-picker')
|
2
|
+
|
3
|
+
= hidden_field_tag "page[stylesheet_ids][]", ''
|
4
|
+
|
5
|
+
%table#stylesheet-selector
|
6
|
+
%tr
|
7
|
+
%td
|
8
|
+
%h3= t('admin.pages.tabs.stylesheets.all_stylesheets')
|
9
|
+
= select("page1", "all_stylesheet_ids", all_stylesheets.collect {|p| [ p.name, p.id ] }, {}, {:multiple => true, :id => 'box1cssView', :style => "height: 200px; width: 200px"})
|
10
|
+
%div
|
11
|
+
%select#box1cssStorage
|
12
|
+
%td.form-actions-left
|
13
|
+
%button.wymupdate.button#tocss2{ :type=>"button"}= ">"
|
14
|
+
%button.wymupdate.button#tocss1{ :type=>"button"}= "<"
|
15
|
+
%td
|
16
|
+
%h3= t('admin.pages.tabs.stylesheets.current_stylesheets')
|
17
|
+
= select("page", "stylesheet_ids", page_stylesheets.collect {|p| [ p.name, p.id ] }, {}, {:multiple => true, :id => 'box2cssView', :style => "height: 200px; width: 200px"})
|
18
|
+
%div
|
19
|
+
%select#box2cssStorage
|
20
|
+
|
21
|
+
%aside#actions
|
22
|
+
%ul
|
23
|
+
%li
|
24
|
+
= link_to t('admin.stylesheets.actions.create_new'), new_admin_stylesheet_path, :class => 'add_icon', :id => 'add-new-stylesheet'
|
25
|
+
|
26
|
+
%p#stylesheet-instructions= t('admin.pages.tabs.stylesheets.add_to_page_instructions')
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<ul>
|
2
|
+
<% if Admin::StylesheetsController.searchable? %>
|
3
|
+
<li>
|
4
|
+
<%= render :partial => "/shared/admin/search",
|
5
|
+
:locals => {
|
6
|
+
:url => admin_stylesheets_url
|
7
|
+
} %>
|
8
|
+
</li>
|
9
|
+
<% end %>
|
10
|
+
<li>
|
11
|
+
<%= link_to t('.create_new'), new_admin_stylesheet_url,
|
12
|
+
:class => "add_icon" %>
|
13
|
+
</li>
|
14
|
+
<% if !searching? and Admin::StylesheetsController.sortable? and Stylesheet.count > 1 %>
|
15
|
+
<li>
|
16
|
+
<%= link_to t('.reorder', :what => "Stylesheets"),
|
17
|
+
admin_stylesheets_url,
|
18
|
+
:id => "reorder_action",
|
19
|
+
:class => "reorder_icon" %>
|
20
|
+
|
21
|
+
<%= link_to t('.reorder_done', :what => "Stylesheets"),
|
22
|
+
admin_stylesheets_url,
|
23
|
+
:id => "reorder_action_done",
|
24
|
+
:style => "display: none;",
|
25
|
+
:class => "reorder_icon" %>
|
26
|
+
</li>
|
27
|
+
<% end %>
|
28
|
+
</ul>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
= form_for [:admin, @stylesheet] do |f|
|
2
|
+
= render :partial => "/shared/admin/error_messages", :locals => { |
|
3
|
+
:object => @stylesheet, |
|
4
|
+
:include_object_name => true |
|
5
|
+
} |
|
6
|
+
.field
|
7
|
+
= f.label :name
|
8
|
+
= f.text_field :name, :class => 'larger widest'
|
9
|
+
.field
|
10
|
+
= f.label :css_type
|
11
|
+
= f.radio_button(:css_type, 'sass')
|
12
|
+
Sass
|
13
|
+
= f.radio_button(:css_type, 'css')
|
14
|
+
Css
|
15
|
+
.field
|
16
|
+
#page-tabs.clearfix.ui-tabs.ui-widget.ui-widget-content.ui-corner-all
|
17
|
+
%ul#page_parts
|
18
|
+
- [:content].each_with_index do |part, part_index|
|
19
|
+
<li class='ui-state-default#{' ui-state-active' if part_index == 0}'>
|
20
|
+
\#{link_to part.to_s.titleize, "##{part}"}
|
21
|
+
#page_part_editors
|
22
|
+
- [:content].each do |part|
|
23
|
+
.page_part{:id => part}
|
24
|
+
= f.text_area part, :rows => 20, :class => 'widest', :style => 'border: 1px solid black'
|
25
|
+
= render :partial => "/shared/admin/form_actions", |
|
26
|
+
:locals => { |
|
27
|
+
:f => f, |
|
28
|
+
:continue_editing => true, |
|
29
|
+
:delete_title => t('delete', :scope => 'admin.stylesheets.stylesheet'), |
|
30
|
+
:delete_confirmation => t('message', :scope => 'shared.admin.delete', :title => @stylesheet.name) |
|
31
|
+
} |
|
32
|
+
- content_for :javascripts do
|
33
|
+
:javascript
|
34
|
+
$(document).ready(function(){
|
35
|
+
page_options.init(false, '', '');
|
36
|
+
});
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% if searching? %>
|
2
|
+
<h2><%= t('results_for', :scope => 'shared.admin.search', :query => params[:search]) %></h2>
|
3
|
+
<% end %>
|
4
|
+
<% if @stylesheets.any? %>
|
5
|
+
<div class='pagination_container'>
|
6
|
+
<%= render :partial => 'stylesheets' %>
|
7
|
+
</div>
|
8
|
+
<% else %>
|
9
|
+
<p>
|
10
|
+
<% unless searching? %>
|
11
|
+
<strong>
|
12
|
+
<%= t('.no_items_yet') %>
|
13
|
+
</strong>
|
14
|
+
<% else %>
|
15
|
+
<%= t('no_results', :scope => 'shared.admin.search') %>
|
16
|
+
<% end %>
|
17
|
+
</p>
|
18
|
+
<% end %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<ul id='sortable_list'>
|
2
|
+
<%= render :partial => 'stylesheet', :collection => @stylesheets %>
|
3
|
+
</ul>
|
4
|
+
<%= render :partial => "/shared/admin/sortable_list",
|
5
|
+
:locals => {
|
6
|
+
:continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true
|
7
|
+
} %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(stylesheet) -%>">
|
2
|
+
<span class='title'>
|
3
|
+
<%= stylesheet.name %>
|
4
|
+
<span class="preview"> </span>
|
5
|
+
</span>
|
6
|
+
<span class='actions'>
|
7
|
+
<%= link_to refinery_icon_tag("application_go.png"), stylesheet_url(stylesheet),
|
8
|
+
:title => t('.view_live_html'),
|
9
|
+
:target => "_blank" %>
|
10
|
+
<%= link_to refinery_icon_tag("application_edit.png"), edit_admin_stylesheet_path(stylesheet),
|
11
|
+
:title => t('.edit') %>
|
12
|
+
<%= link_to refinery_icon_tag("delete.png"), admin_stylesheet_path(stylesheet),
|
13
|
+
:class => "cancel confirm-delete",
|
14
|
+
:title => t('.delete'),
|
15
|
+
:confirm => t('message', :scope => 'shared.admin.delete', :title => stylesheet.name),
|
16
|
+
:method => :delete %>
|
17
|
+
</span>
|
18
|
+
</li>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<section id='records'>
|
2
|
+
<%= render :partial => 'records' %>
|
3
|
+
</section>
|
4
|
+
<aside id='actions'>
|
5
|
+
<%= render :partial => 'actions' %>
|
6
|
+
</aside>
|
7
|
+
<%= render :partial => '/shared/admin/make_sortable',
|
8
|
+
:locals => {
|
9
|
+
:tree => false
|
10
|
+
} if !searching? and Admin::StylesheetsController.sortable? and Stylesheet.count > 1 %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% content_for :body_content_left do %>
|
2
|
+
<ul id="stylesheets">
|
3
|
+
<% @stylesheets.each do |stylesheet| %>
|
4
|
+
<li>
|
5
|
+
<%= link_to stylesheet.name, stylesheet_url(stylesheet) %>
|
6
|
+
</li>
|
7
|
+
<% end %>
|
8
|
+
</ul>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= render :partial => "/shared/content_page" %>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<% content_for :body_content_title do %>
|
2
|
+
<%= @stylesheet.name %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% content_for :body_content_left do %>
|
6
|
+
<section>
|
7
|
+
<h1>Name</h1>
|
8
|
+
<p>
|
9
|
+
<%=raw @stylesheet.name %>
|
10
|
+
</p>
|
11
|
+
</section>
|
12
|
+
<section>
|
13
|
+
<h1>Content</h1>
|
14
|
+
<p>
|
15
|
+
<%=raw @stylesheet.content %>
|
16
|
+
</p>
|
17
|
+
</section>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<% content_for :body_content_right do %>
|
21
|
+
<aside>
|
22
|
+
<h2><%= t('.other') %></h2>
|
23
|
+
<ul id="stylesheets">
|
24
|
+
<% @stylesheets.each do |stylesheet| %>
|
25
|
+
<li>
|
26
|
+
<%= link_to stylesheet.name, stylesheet_url(stylesheet) %>
|
27
|
+
</li>
|
28
|
+
<% end %>
|
29
|
+
</ul>
|
30
|
+
</aside>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
<%= render :partial => "/shared/content_page" %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
en:
|
2
|
+
shared:
|
3
|
+
admin:
|
4
|
+
image_picker:
|
5
|
+
image: image
|
6
|
+
plugins:
|
7
|
+
stylesheets:
|
8
|
+
title: Stylesheets
|
9
|
+
admin:
|
10
|
+
stylesheets:
|
11
|
+
actions:
|
12
|
+
create_new: Add New Stylesheet
|
13
|
+
reorder: Reorder Stylesheets
|
14
|
+
reorder_done: Done Reordering Stylesheets
|
15
|
+
records:
|
16
|
+
title: Stylesheets
|
17
|
+
sorry_no_results: Sorry! There are no results found.
|
18
|
+
no_items_yet: There are no Stylesheets yet. Click "Add New Stylesheet" to add your first stylesheet.
|
19
|
+
stylesheet:
|
20
|
+
view_live_html: View this stylesheet live <br/><em>(opens in a new window)</em>
|
21
|
+
edit: Edit this stylesheet
|
22
|
+
delete: Remove this stylesheet forever
|
23
|
+
pages:
|
24
|
+
tabs:
|
25
|
+
stylesheets:
|
26
|
+
add_to_page_instructions: '*Add a stylesheet to the page by clicking the right arrow or double clicking on the name of the stylesheet.'
|
27
|
+
current_stylesheets: 'Currently Included Stylesheets'
|
28
|
+
all_stylesheets: 'All Available Stylesheets'
|
29
|
+
stylesheets:
|
30
|
+
show:
|
31
|
+
other: Other Stylesheets
|
@@ -0,0 +1,25 @@
|
|
1
|
+
lolcat:
|
2
|
+
shared:
|
3
|
+
admin:
|
4
|
+
image_picker:
|
5
|
+
image: IMAGE
|
6
|
+
plugins:
|
7
|
+
stylesheets:
|
8
|
+
title: Stylesheets
|
9
|
+
admin:
|
10
|
+
stylesheets:
|
11
|
+
actions:
|
12
|
+
create_new: CREATE NEW Stylesheet
|
13
|
+
reorder: REORDR Stylesheets
|
14
|
+
reorder_done: DUN REORDERIN Stylesheets
|
15
|
+
records:
|
16
|
+
title: Stylesheets
|
17
|
+
sorry_no_results: SRY! THAR R NO RESULTS FINDZ.
|
18
|
+
no_items_yet: THAR R NO Stylesheets YET. CLICK "CREATE NEW Stylesheet" 2 ADD UR FURST stylesheet.
|
19
|
+
stylesheet:
|
20
|
+
view_live_html: VIEW DIS stylesheet LIV <BR/><EM>(OPENS IN NEW WINDOW)</EM>
|
21
|
+
edit: EDIT DIS stylesheet
|
22
|
+
delete: REMOOV DIS stylesheet FOREVR
|
23
|
+
stylesheets:
|
24
|
+
show:
|
25
|
+
other: OTHR Stylesheets
|
@@ -0,0 +1,21 @@
|
|
1
|
+
nb:
|
2
|
+
plugins:
|
3
|
+
stylesheets:
|
4
|
+
title: Stylesheets
|
5
|
+
admin:
|
6
|
+
stylesheets:
|
7
|
+
actions:
|
8
|
+
create_new: Lag en ny Stylesheet
|
9
|
+
reorder: Endre rekkefølgen på Stylesheets
|
10
|
+
reorder_done: Ferdig å endre rekkefølgen Stylesheets
|
11
|
+
records:
|
12
|
+
title: Stylesheets
|
13
|
+
sorry_no_results: Beklager! Vi fant ikke noen resultater.
|
14
|
+
no_items_yet: Det er ingen Stylesheets enda. Klikk på "Lag en ny Stylesheet" for å legge til din første stylesheet.
|
15
|
+
stylesheet:
|
16
|
+
view_live_html: Vis hvordan denne stylesheet ser ut offentlig <br/><em>(åpner i et nytt vindu)</em>
|
17
|
+
edit: Rediger denne stylesheet
|
18
|
+
delete: Fjern denne stylesheet permanent
|
19
|
+
stylesheets:
|
20
|
+
show:
|
21
|
+
other: Andre Stylesheets
|
@@ -0,0 +1,21 @@
|
|
1
|
+
nl:
|
2
|
+
plugins:
|
3
|
+
stylesheets:
|
4
|
+
title: Stylesheets
|
5
|
+
admin:
|
6
|
+
stylesheets:
|
7
|
+
actions:
|
8
|
+
create_new: Maak een nieuwe Stylesheet
|
9
|
+
reorder: Wijzig de volgorde van de Stylesheets
|
10
|
+
reorder_done: Klaar met het wijzingen van de volgorde van de Stylesheets
|
11
|
+
records:
|
12
|
+
title: Stylesheets
|
13
|
+
sorry_no_results: Helaas! Er zijn geen resultaten gevonden.
|
14
|
+
no_items_yet: Er zijn nog geen Stylesheets. Druk op 'Maak een nieuwe Stylesheet' om de eerste aan te maken.
|
15
|
+
stylesheet:
|
16
|
+
view_live_html: Bekijk deze stylesheet op de website <br/><em>(opent een nieuw venster)</em>
|
17
|
+
edit: Bewerk deze stylesheet
|
18
|
+
delete: Verwijder deze stylesheet voor eeuwig
|
19
|
+
stylesheets:
|
20
|
+
show:
|
21
|
+
other: Andere Stylesheets
|
data/config/routes.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
Refinery::Application.routes.draw do
|
2
|
+
resources :stylesheets, :only => [:index, :show]
|
3
|
+
|
4
|
+
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
|
5
|
+
resources :stylesheets, :except => :show do
|
6
|
+
collection do
|
7
|
+
post :update_positions
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Refinery
|
2
|
+
module Stylesheets
|
3
|
+
module Dragonfly
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def setup!
|
7
|
+
app_stylesheets = ::Dragonfly[:stylesheets]
|
8
|
+
app_stylesheets.configure_with(:rails) do |c|
|
9
|
+
c.datastore.root_path = Rails.root.join('public', 'system', 'stylesheets').to_s
|
10
|
+
# This url_format it so that dragonfly urls work in traditional
|
11
|
+
# situations where the filename and extension are required, e.g. lightbox.
|
12
|
+
# What this does is takes the url that is about to be produced e.g.
|
13
|
+
# /system/images/BAhbB1sHOgZmIiMyMDEwLzA5LzAxL1NTQ19DbGllbnRfQ29uZi5qcGdbCDoGcDoKdGh1bWIiDjk0MngzNjAjYw
|
14
|
+
# and adds the filename onto the end (say the image was 'refinery_is_awesome.jpg')
|
15
|
+
# /system/images/BAhbB1sHOgZmIiMyMDEwLzA5LzAxL1NTQ19DbGllbnRfQ29uZi5qcGdbCDoGcDoKdGh1bWIiDjk0MngzNjAjYw/refinery_is_awesome.jpg
|
16
|
+
c.url_format = '/system/stylesheets/:job/:basename.:format'
|
17
|
+
c.secret = ::Refinery::Setting.find_or_set(:dragonfly_secret, Array.new(24) { rand(256) }.pack('C*').unpack('H*').first)
|
18
|
+
end
|
19
|
+
|
20
|
+
if ::Refinery.s3_backend
|
21
|
+
app_stylesheets.configure_with(:heroku, ENV['S3_BUCKET'])
|
22
|
+
# Dragonfly doesn't set the S3 region, so we have to do this manually
|
23
|
+
app_stylesheets.datastore.configure do |d|
|
24
|
+
d.region = ENV['S3_REGION'] if ENV['S3_REGION'] # otherwise defaults to 'us-east-1'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
#app_stylesheets.define_macro(::ActiveRecord::Base, :image_accessor)
|
29
|
+
app_stylesheets.analyser.register(::Dragonfly::Analysis::FileCommandAnalyser)
|
30
|
+
end
|
31
|
+
|
32
|
+
def attach!(app)
|
33
|
+
### Extend active record ###
|
34
|
+
|
35
|
+
app.config.middleware.insert_after 'Rack::Lock', 'Dragonfly::Middleware', :stylesheets
|
36
|
+
|
37
|
+
app.config.middleware.insert_before 'Dragonfly::Middleware', 'Rack::Cache', {
|
38
|
+
:verbose => Rails.env.development?,
|
39
|
+
:metastore => "file:#{Rails.root.join('tmp', 'dragonfly', 'cache', 'meta')}",
|
40
|
+
:entitystore => "file:#{Rails.root.join('tmp', 'dragonfly', 'cache', 'body')}"
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'refinerycms-base'
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
module Stylesheets
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
initializer "static assets" do |app|
|
7
|
+
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
8
|
+
end
|
9
|
+
|
10
|
+
refinery.after_inclusion do
|
11
|
+
Page.send :has_and_belongs_to_many_stylesheets
|
12
|
+
Page.send :attr_accessible, :stylesheet_ids
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.register(tab)
|
16
|
+
tab.name = "stylesheets"
|
17
|
+
tab.partial = "/admin/pages/tabs/stylesheets/index"
|
18
|
+
end
|
19
|
+
|
20
|
+
config.after_initialize do
|
21
|
+
|
22
|
+
::Refinery::Pages::Tab.register do |tab|
|
23
|
+
register tab
|
24
|
+
end
|
25
|
+
|
26
|
+
Refinery::Plugin.register do |plugin|
|
27
|
+
plugin.name = "stylesheets"
|
28
|
+
plugin.activity = {
|
29
|
+
:class => Stylesheet,
|
30
|
+
:title => 'name'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
module Refinery
|
41
|
+
module Stylesheets
|
42
|
+
module Extension
|
43
|
+
|
44
|
+
def self.included(base)
|
45
|
+
base.extend(ClassMethods)
|
46
|
+
end
|
47
|
+
|
48
|
+
module ClassMethods
|
49
|
+
def has_and_belongs_to_many_stylesheets
|
50
|
+
has_and_belongs_to_many :stylesheets
|
51
|
+
|
52
|
+
include Refinery::Stylesheets::Extension::InstanceMethods
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
module InstanceMethods
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
ActiveRecord::Base.send(:include, Refinery::Stylesheets::Extension)
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: refinerycms-stylesheets
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Trevor Jones
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-06-06 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Ruby on Rails Stylesheets engine for Refinery CMS
|
23
|
+
email:
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- lib/tasks/stylesheets.rake
|
32
|
+
- lib/refinery/stylesheets/dragonfly.rb
|
33
|
+
- lib/generators/refinerycms_stylesheets_generator.rb
|
34
|
+
- lib/refinerycms-stylesheets.rb
|
35
|
+
- config/locales/nl.yml
|
36
|
+
- config/locales/en.yml
|
37
|
+
- config/locales/lolcat.yml
|
38
|
+
- config/locales/nb.yml
|
39
|
+
- config/routes.rb
|
40
|
+
- app/controllers/admin/stylesheets_controller.rb
|
41
|
+
- app/controllers/stylesheets_controller.rb
|
42
|
+
- app/models/stylesheet.rb
|
43
|
+
- app/views/stylesheets/show.html.erb
|
44
|
+
- app/views/stylesheets/index.html.erb
|
45
|
+
- app/views/admin/stylesheets/_form.html.haml
|
46
|
+
- app/views/admin/stylesheets/new.html.haml
|
47
|
+
- app/views/admin/stylesheets/_actions.html.erb
|
48
|
+
- app/views/admin/stylesheets/_records.html.erb
|
49
|
+
- app/views/admin/stylesheets/_sortable_list.html.erb
|
50
|
+
- app/views/admin/stylesheets/index.html.erb
|
51
|
+
- app/views/admin/stylesheets/_stylesheets.html.erb
|
52
|
+
- app/views/admin/stylesheets/_stylesheet.html.erb
|
53
|
+
- app/views/admin/stylesheets/edit.html.haml
|
54
|
+
- app/views/admin/pages/tabs/stylesheets/_stylesheet_picker.html.haml
|
55
|
+
- app/views/admin/pages/tabs/stylesheets/_index.html.haml
|
56
|
+
has_rdoc: true
|
57
|
+
homepage:
|
58
|
+
licenses: []
|
59
|
+
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 3
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
version: "0"
|
83
|
+
requirements: []
|
84
|
+
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 1.4.2
|
87
|
+
signing_key:
|
88
|
+
specification_version: 3
|
89
|
+
summary: Stylesheets engine for Refinery CMS
|
90
|
+
test_files: []
|
91
|
+
|