spreefinery_themes 1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/images/jstree/file.png +0 -0
- data/app/assets/images/jstree/folder.png +0 -0
- data/app/assets/javascripts/code_mirror_manager.coffee +105 -0
- data/app/assets/javascripts/editor.coffee +3 -0
- data/app/assets/javascripts/files_manager.coffee +41 -0
- data/app/assets/javascripts/jstree_manager.coffee +177 -0
- data/app/assets/javascripts/themes.coffee +21 -0
- data/app/assets/stylesheets/editor.css +40 -0
- data/app/assets/stylesheets/themes.css +50 -0
- data/app/controllers/refinery/themes/admin/editor_controller.rb +73 -0
- data/app/controllers/refinery/themes/admin/themes_controller.rb +60 -0
- data/app/controllers/refinery/themes/theme_controller.rb +12 -0
- data/app/decorators/action_view_decorator.rb +6 -0
- data/app/decorators/application_controller_decorator.rb +7 -0
- data/app/decorators/base_controller_decorator.rb +4 -0
- data/app/decorators/drops_decorator.rb +33 -0
- data/app/decorators/liquid_strainer_decorator.rb +23 -0
- data/app/decorators/refinery_admin_pages_controller_decorator.rb +6 -0
- data/app/decorators/refinery_pages_controller_decorator.rb +17 -0
- data/app/decorators/refinery_sessions_controller_decorator.rb +3 -0
- data/app/decorators/spree_base_controller_decorator.rb +3 -0
- data/app/decorators/spree_checkout_controller_decorator.rb +42 -0
- data/app/decorators/template_renderer_decorator.rb +25 -0
- data/app/helpers/refinery/themes/admin/themes_helper.rb +9 -0
- data/app/liquid/blocks/capture_variable.rb +36 -0
- data/app/liquid/blocks/content_for.rb +55 -0
- data/app/liquid/blocks/rss.rb +27 -0
- data/app/liquid/blocks/with_scope.rb +55 -0
- data/app/liquid/drops/address_drop.rb +5 -0
- data/app/liquid/drops/country_drop.rb +5 -0
- data/app/liquid/drops/form_builder_drop.rb +15 -0
- data/app/liquid/drops/image_drop.rb +5 -0
- data/app/liquid/drops/line_item_drop.rb +41 -0
- data/app/liquid/drops/menu_item_drop.rb +17 -0
- data/app/liquid/drops/option_type_drop.rb +5 -0
- data/app/liquid/drops/option_value_drop.rb +3 -0
- data/app/liquid/drops/order_drop.rb +19 -0
- data/app/liquid/drops/page_drop.rb +5 -0
- data/app/liquid/drops/page_part_drop.rb +18 -0
- data/app/liquid/drops/post_category_drop.rb +5 -0
- data/app/liquid/drops/post_comment_drop.rb +5 -0
- data/app/liquid/drops/post_drop.rb +21 -0
- data/app/liquid/drops/product_drop.rb +81 -0
- data/app/liquid/drops/product_property_drop.rb +5 -0
- data/app/liquid/drops/property_drop.rb +5 -0
- data/app/liquid/drops/role_drop.rb +5 -0
- data/app/liquid/drops/spree_money_drop.rb +10 -0
- data/app/liquid/drops/state_drop.rb +6 -0
- data/app/liquid/drops/taxon_drop.rb +24 -0
- data/app/liquid/drops/taxonomy_drop.rb +6 -0
- data/app/liquid/drops/user_drop.rb +22 -0
- data/app/liquid/drops/variant_drop.rb +24 -0
- data/app/liquid/filters/filters.rb +128 -0
- data/app/liquid/filters/protected.rb +28 -0
- data/app/liquid/filters/rails_filters.rb +73 -0
- data/app/liquid/tags/rails_tags.rb +63 -0
- data/app/liquid/tags/refinery_tags.rb +33 -0
- data/app/liquid/tags/spree_tags.rb +164 -0
- data/app/models/file_manager.rb +206 -0
- data/app/models/refinery/themes/theme.rb +79 -0
- data/app/views/refinery/admin/_dialog_success.html.erb +5 -0
- data/app/views/refinery/shared/_menu_branch.html.erb +30 -0
- data/app/views/refinery/shared/_pages_menu.html.erb +14 -0
- data/app/views/refinery/themes/admin/editor/_editor_actions.html.erb +9 -0
- data/app/views/refinery/themes/admin/editor/file.html.erb +50 -0
- data/app/views/refinery/themes/admin/editor/index.html.erb +15 -0
- data/app/views/refinery/themes/admin/editor/upload_file.html.erb +16 -0
- data/app/views/refinery/themes/admin/shared/_actions.html.erb +19 -0
- data/app/views/refinery/themes/admin/shared/_theme_assets.html.erb +6 -0
- data/app/views/refinery/themes/admin/themes/index.html.erb +58 -0
- data/app/views/refinery/themes/admin/themes/upload.html.erb +17 -0
- data/app/views/spree/products/_variants.html.erb +19 -0
- data/config/initializers/liquid_engine.rb +8 -0
- data/config/initializers/refinery/core.rb +4 -0
- data/config/initializers/refinery/pages.rb +9 -0
- data/config/locales/en.yml +14 -0
- data/config/routes.rb +42 -0
- data/lib/action_view/template/handlers/liquid.rb +88 -0
- data/lib/editable.rb +26 -0
- data/lib/hash.rb +5 -0
- data/lib/liquid/base_drop.rb +62 -0
- data/lib/spreefinery/engine.rb +46 -0
- data/lib/spreefinery_themes.rb +21 -0
- data/readme.md +27 -0
- metadata +178 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
module Liquid
|
2
|
+
module Tags
|
3
|
+
|
4
|
+
# Filter a collection
|
5
|
+
#
|
6
|
+
# Usage:
|
7
|
+
#
|
8
|
+
# {% with_scope main_developer: 'John Doe', active: true %}
|
9
|
+
# {% for project in contents.projects %}
|
10
|
+
# {{ project.name }}
|
11
|
+
# {% endfor %}
|
12
|
+
# {% endwith_scope %}
|
13
|
+
#
|
14
|
+
|
15
|
+
class WithScope < ::Liquid::Block
|
16
|
+
|
17
|
+
TagAttributes = /(\w+|\w+\.\w+)\s*\:\s*(#{::Liquid::QuotedFragment})/
|
18
|
+
|
19
|
+
def initialize(tag_name, markup, tokens)
|
20
|
+
@attributes = HashWithIndifferentAccess.new
|
21
|
+
|
22
|
+
markup.scan(TagAttributes) do |key, value|
|
23
|
+
@attributes[key] = value unless key.eql?('render_tag')
|
24
|
+
end
|
25
|
+
|
26
|
+
if markup =~ /render_tag:([_a-z0-9]+)/
|
27
|
+
@style = $1
|
28
|
+
end
|
29
|
+
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def render(context)
|
34
|
+
context.stack do
|
35
|
+
result = render_all(@nodelist, context).join
|
36
|
+
end
|
37
|
+
|
38
|
+
context.stack do
|
39
|
+
context['with_scope'] = decode(@attributes.clone, context)
|
40
|
+
render_all(@nodelist, context)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def decode(attributes, context)
|
47
|
+
attributes.each_pair do |key, value|
|
48
|
+
attributes[key] = context[value]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
::Liquid::Template.register_tag('with_scope', WithScope)
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class ActionView::Helpers::FormBuilderDrop < Liquid::BaseDrop
|
2
|
+
|
3
|
+
def self.included
|
4
|
+
include Rails.application.routes.url_helpers
|
5
|
+
end
|
6
|
+
|
7
|
+
def text_field(options)
|
8
|
+
@source.text_field(options['method'], options.except('method'))
|
9
|
+
end
|
10
|
+
|
11
|
+
def number_field(options)
|
12
|
+
@source.number_field(options['method'], options.except('method'))
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class Spree::LineItemDrop < Clot::BaseDrop
|
2
|
+
|
3
|
+
self.liquid_attributes = [:id, :quantity, :price, :order]
|
4
|
+
|
5
|
+
def variant
|
6
|
+
@source.variant
|
7
|
+
end
|
8
|
+
|
9
|
+
def increment_quantity
|
10
|
+
@source.quantity += 1
|
11
|
+
end
|
12
|
+
|
13
|
+
def decrement_quantity
|
14
|
+
@source.quantity -= 1
|
15
|
+
end
|
16
|
+
|
17
|
+
def amount
|
18
|
+
@source.price * @source.quantity
|
19
|
+
end
|
20
|
+
|
21
|
+
def total_amount
|
22
|
+
amount
|
23
|
+
end
|
24
|
+
|
25
|
+
def adjust_quantity
|
26
|
+
@source.quantity = 0 if @source.quantity.nil? || @source.quantity < 0
|
27
|
+
end
|
28
|
+
|
29
|
+
def copy_price
|
30
|
+
@source.price = @source.variant.price if @source.variant && @source.price.nil?
|
31
|
+
end
|
32
|
+
|
33
|
+
def single_money
|
34
|
+
@source.single_money
|
35
|
+
end
|
36
|
+
|
37
|
+
def display_amount
|
38
|
+
@source.display_amount
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Refinery::MenuItemDrop < Clot::BaseDrop
|
2
|
+
|
3
|
+
self.liquid_attributes = [:title, :parent, :depth, :menu, :menu_match]
|
4
|
+
|
5
|
+
def url
|
6
|
+
@context.registers[:action_view].url_for(@source.url)
|
7
|
+
end
|
8
|
+
|
9
|
+
def children
|
10
|
+
@source.children
|
11
|
+
end
|
12
|
+
|
13
|
+
def ancestors
|
14
|
+
@source.ancestors
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Spree::OrderDrop < Clot::BaseDrop
|
2
|
+
|
3
|
+
self.liquid_attributes = [:id, :line_items, :ship_address, :bill_address, :user, :adjustments, :number, :email,
|
4
|
+
:total, :item_total, :ship_total, :adjustment_total, :state, :tax_total,
|
5
|
+
:special_instructions]
|
6
|
+
|
7
|
+
def token
|
8
|
+
@source.token
|
9
|
+
end
|
10
|
+
|
11
|
+
def display_total
|
12
|
+
@source.display_total
|
13
|
+
end
|
14
|
+
|
15
|
+
def display_item_total
|
16
|
+
@source.display_item_total
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Refinery::PagePartDrop < Clot::BaseDrop
|
2
|
+
|
3
|
+
self.liquid_attributes = [:created_at, :updated_at, :id, :page, :position]
|
4
|
+
|
5
|
+
def page_id
|
6
|
+
@page_id ||= @source.refinery_page_id
|
7
|
+
end
|
8
|
+
|
9
|
+
def key
|
10
|
+
@key ||= @source.title.underscore.split.join("_")
|
11
|
+
end
|
12
|
+
|
13
|
+
def body
|
14
|
+
liquid = Liquid::Template.parse @source.body
|
15
|
+
liquid.render(@context.environments[0])
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Refinery::Blog::PostDrop < Clot::BaseDrop
|
2
|
+
|
3
|
+
self.liquid_attributes = [:created_at, :updated_at, :id, :draft, :published_at, :author, :cached_slug,
|
4
|
+
:custom_url, :custom_teaser, :source_url, :source_url_title, :access_count, :slug,
|
5
|
+
:categories, :comments]
|
6
|
+
|
7
|
+
def body
|
8
|
+
liquid = Liquid::Template.parse @source.body
|
9
|
+
liquid.render(@context.environments[0])
|
10
|
+
end
|
11
|
+
|
12
|
+
def title
|
13
|
+
liquid = Liquid::Template.parse @source.title
|
14
|
+
liquid.render(@context.environments[0])
|
15
|
+
end
|
16
|
+
|
17
|
+
def live?
|
18
|
+
@source.live?
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
class Spree::ProductDrop < Clot::BaseDrop
|
2
|
+
|
3
|
+
self.liquid_attributes = [:id, :name, :price, :permalink,
|
4
|
+
:available_on, :shipping_category, :deleted_at,
|
5
|
+
:meta_description, :meta_keywords, :product_option_types,
|
6
|
+
:option_types, :product_properties, :properties, :images, :taxons,
|
7
|
+
:master, :variants, :variants_including_master
|
8
|
+
]
|
9
|
+
|
10
|
+
def description
|
11
|
+
@source.description
|
12
|
+
end
|
13
|
+
|
14
|
+
def master
|
15
|
+
@source.master
|
16
|
+
end
|
17
|
+
|
18
|
+
def variants
|
19
|
+
@source.variants
|
20
|
+
end
|
21
|
+
|
22
|
+
def has_variants?
|
23
|
+
@source.has_variants?
|
24
|
+
end
|
25
|
+
|
26
|
+
def on_sale?
|
27
|
+
@source.on_sale?
|
28
|
+
end
|
29
|
+
|
30
|
+
def on_hand
|
31
|
+
@source.on_hand
|
32
|
+
end
|
33
|
+
|
34
|
+
def price_with_currency
|
35
|
+
@source.price_in(Spree::Config[:currency]).display_price
|
36
|
+
end
|
37
|
+
|
38
|
+
def variants_including_master
|
39
|
+
@source.variants_including_master
|
40
|
+
end
|
41
|
+
|
42
|
+
def option_types
|
43
|
+
@source.option_types
|
44
|
+
end
|
45
|
+
|
46
|
+
def product_properties
|
47
|
+
@source.product_properties
|
48
|
+
end
|
49
|
+
|
50
|
+
def properties
|
51
|
+
@source.properties
|
52
|
+
end
|
53
|
+
|
54
|
+
def taxons
|
55
|
+
@source.taxons
|
56
|
+
end
|
57
|
+
|
58
|
+
def product_option_types
|
59
|
+
@source.product_option_types
|
60
|
+
end
|
61
|
+
|
62
|
+
def variant_images
|
63
|
+
@source.variant_images
|
64
|
+
end
|
65
|
+
|
66
|
+
def product_image_url
|
67
|
+
@source.images.first.attachment.url(:product)
|
68
|
+
end
|
69
|
+
|
70
|
+
def small_image_url
|
71
|
+
@source.images.first.attachment.url(:small)
|
72
|
+
end
|
73
|
+
|
74
|
+
def large_image_url
|
75
|
+
@source.images.first.attachment.url(:large)
|
76
|
+
end
|
77
|
+
|
78
|
+
def original_image_url
|
79
|
+
@source.images.first.attachment.url(:original)
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Spree::TaxonDrop < Clot::BaseDrop
|
2
|
+
|
3
|
+
self.liquid_attributes = [:name, :description, :children, :products, :taxonomy, :parent]
|
4
|
+
|
5
|
+
def siblings
|
6
|
+
@source.siblings
|
7
|
+
end
|
8
|
+
|
9
|
+
def self_and_ancestors
|
10
|
+
@source.self_and_ancestors
|
11
|
+
end
|
12
|
+
|
13
|
+
def ancestors
|
14
|
+
@source.ancestors
|
15
|
+
end
|
16
|
+
|
17
|
+
def children
|
18
|
+
@source.children
|
19
|
+
end
|
20
|
+
|
21
|
+
def permalink
|
22
|
+
@source.permalink
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Refinery::UserDrop < Clot::BaseDrop
|
2
|
+
|
3
|
+
#class_attribute :liquid_attributes
|
4
|
+
self.liquid_attributes = [:email, :login]
|
5
|
+
|
6
|
+
def orders
|
7
|
+
@source.orders
|
8
|
+
end
|
9
|
+
|
10
|
+
def roles
|
11
|
+
@source.roles
|
12
|
+
end
|
13
|
+
|
14
|
+
def ship_address
|
15
|
+
@source.ship_address
|
16
|
+
end
|
17
|
+
|
18
|
+
def bill_address
|
19
|
+
@source.bill_address
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Spree::VariantDrop < Clot::BaseDrop
|
2
|
+
|
3
|
+
self.liquid_attributes = [:id, :sku, :price, :weight, :height, :width, :depth, :deleted_at, :is_master,
|
4
|
+
:in_stock,:count_on_hand, :cost_price, :position , :images, :inventory_units,
|
5
|
+
:line_items, :option_values
|
6
|
+
]
|
7
|
+
|
8
|
+
def available?
|
9
|
+
@source.available?
|
10
|
+
end
|
11
|
+
|
12
|
+
def deleted?
|
13
|
+
@source.deleted?
|
14
|
+
end
|
15
|
+
|
16
|
+
def product
|
17
|
+
@source.product
|
18
|
+
end
|
19
|
+
|
20
|
+
def options_text
|
21
|
+
@source.options_text
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|