smithycms 0.5.1 → 0.5.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/smithy/application.js +1 -0
- data/app/assets/javascripts/smithy/assets.js.coffee +7 -5
- data/app/assets/javascripts/smithy/copy_link.js.coffee.erb +19 -0
- data/app/assets/javascripts/smithy/{templates.js → editor.js} +8 -6
- data/app/assets/javascripts/smithy/nested_forms.js +2 -2
- data/app/assets/stylesheets/smithy/bootstrap_and_overrides.css.scss +1 -0
- data/app/assets/stylesheets/smithy/templates.css.scss +3 -0
- data/app/controllers/smithy/assets_controller.rb +4 -2
- data/app/controllers/smithy/{content_pieces_controller.rb → content_resources_controller.rb} +9 -4
- data/app/helpers/smithy/application_helper.rb +2 -2
- data/app/helpers/smithy/templates_helper.rb +12 -0
- data/app/helpers/smithy/upload_helper.rb +2 -0
- data/app/models/smithy/asset.rb +4 -1
- data/app/models/smithy/page.rb +1 -1
- data/app/models/smithy/page_proxy.rb +1 -1
- data/app/models/smithy/site.rb +1 -0
- data/app/views/layouts/smithy/shared/_flash.html.erb +1 -1
- data/app/views/layouts/smithy/shared/_footer.html.erb +1 -1
- data/app/views/layouts/smithy/shared/_nav.html.erb +4 -1
- data/app/views/smithy/assets/_asset.html.erb +8 -5
- data/app/views/smithy/assets/_form.html.erb +5 -4
- data/app/views/smithy/assets/create.js.erb +2 -1
- data/app/views/smithy/assets/index.html.erb +2 -2
- data/app/views/smithy/content_blocks/edit.html.erb +1 -1
- data/app/views/smithy/{content_pieces → content_resources}/edit.html.erb +6 -1
- data/app/views/smithy/{content_pieces → content_resources}/index.html.erb +4 -0
- data/app/views/smithy/content_resources/new.html.erb +13 -0
- data/app/views/smithy/pages/_form.html.erb +1 -2
- data/config/initializers/dragonfly.rb +3 -5
- data/db/migrate/20141113220013_change_page_keywords_to_text.rb +5 -0
- data/lib/smithy/{content_pieces → content_resources}/base.rb +2 -2
- data/lib/smithy/content_resources/registry.rb +31 -0
- data/lib/smithy/content_resources.rb +2 -0
- data/lib/smithy/dependencies.rb +1 -1
- data/lib/smithy/dragonfly/asset_helper.rb +2 -2
- data/lib/smithy/engine.rb +4 -0
- data/lib/smithy/liquid/filters/smithy_helpers.rb +42 -0
- data/lib/smithy/liquid/rendering.rb +6 -4
- data/lib/smithy/liquid/tags/html.rb +8 -2
- data/lib/smithy/liquid/tags/include_file.rb +1 -1
- data/lib/smithy/liquid/tags/nav.rb +3 -2
- data/lib/smithy/liquid.rb +1 -0
- data/lib/smithy/version.rb +1 -1
- data/lib/smithy.rb +1 -2
- data/vendor/assets/images/ZeroClipboard.swf +0 -0
- data/vendor/assets/javascripts/zeroclipboard-2.2.0/ZeroClipboard.js +2581 -0
- data/vendor/assets/javascripts/zeroclipboard-2.2.0/ZeroClipboard.min.js +10 -0
- data/vendor/assets/javascripts/zeroclipboard-2.2.0/ZeroClipboard.min.map +1 -0
- metadata +75 -19
- data/app/views/smithy/content_pieces/new.html.erb +0 -8
- data/lib/smithy/content_pieces/registry.rb +0 -39
@@ -34,15 +34,17 @@ module Smithy
|
|
34
34
|
'url' => request.url,
|
35
35
|
'now' => Time.now.utc,
|
36
36
|
'today' => Date.today,
|
37
|
-
'site' =>
|
37
|
+
'site' => Smithy::Site.instance
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
41
|
-
def smithy_default_registers
|
41
|
+
def smithy_default_registers(controller=nil)
|
42
|
+
controller = self.controller if self.respond_to?(:controller)
|
43
|
+
controller ||= self
|
42
44
|
{
|
43
|
-
:controller =>
|
45
|
+
:controller => controller,
|
44
46
|
:page => @page,
|
45
|
-
:site =>
|
47
|
+
:site => Smithy::Site.instance
|
46
48
|
}
|
47
49
|
end
|
48
50
|
end
|
@@ -22,6 +22,10 @@ module Smithy
|
|
22
22
|
tag.match(/\.#{ext}$/) ? tag : "#{tag}.#{ext}"
|
23
23
|
end
|
24
24
|
|
25
|
+
def tag_without_ext(ext)
|
26
|
+
tag.sub(/\.#{ext}$/, '')
|
27
|
+
end
|
28
|
+
|
25
29
|
def render(context)
|
26
30
|
raise Error.new("please override Smithy::Liquid::Tag::Html::Base#render")
|
27
31
|
end
|
@@ -42,13 +46,15 @@ module Smithy
|
|
42
46
|
class SmithyJavascriptIncludeTag < Base
|
43
47
|
def render(context)
|
44
48
|
controller = context.registers[:controller]
|
45
|
-
|
49
|
+
javascript = Smithy::Template.javascripts.find_by(name: tag_without_ext('js'))
|
50
|
+
controller.view_context.send(:javascript_include_tag, "/templates/javascripts/#{tag_with_ext('js')}?#{javascript.updated_at.to_s(:number) if javascript.present?}")
|
46
51
|
end
|
47
52
|
end
|
48
53
|
class SmithyStylesheetLinkTag < Base
|
49
54
|
def render(context)
|
50
55
|
controller = context.registers[:controller]
|
51
|
-
|
56
|
+
stylesheet = Smithy::Template.stylesheets.find_by(name: tag_without_ext('css'))
|
57
|
+
controller.view_context.send(:stylesheet_link_tag, "/templates/stylesheets/#{tag_with_ext('css')}?#{stylesheet.updated_at.to_s(:number) if stylesheet.present?}")
|
52
58
|
end
|
53
59
|
end
|
54
60
|
end
|
@@ -75,7 +75,7 @@ module Liquid
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def read_template_from_file_system(context)
|
78
|
-
file_system = Liquid::
|
78
|
+
file_system = Liquid::LocalFileSystem.new(Rails.root.join('app', 'views'))
|
79
79
|
|
80
80
|
# make read_template_file call backwards-compatible.
|
81
81
|
case file_system.method(:read_template_file).arity
|
@@ -64,7 +64,8 @@ module Smithy
|
|
64
64
|
|
65
65
|
def render_wrapper(list_items, id = nil)
|
66
66
|
list_id = id.present? ? " id=\"#{id}\"" : ''
|
67
|
-
|
67
|
+
list_class = @options[:class].present? ? " class=\"#{@options[:class]}\"" : ''
|
68
|
+
%Q{<ul#{list_id}#{list_class}>\n#{list_items}\n</ul>}
|
68
69
|
end
|
69
70
|
|
70
71
|
def root_node
|
@@ -87,7 +88,7 @@ module Smithy
|
|
87
88
|
|
88
89
|
def write_child_list_items?(parent, depth)
|
89
90
|
return false unless parent.present? && !parent.leaf?
|
90
|
-
return true if @source == '
|
91
|
+
return true if @source == 'site-section' && @page.self_and_ancestors.include?(parent)
|
91
92
|
depth > @options[:depth] ? false : true
|
92
93
|
end
|
93
94
|
|
data/lib/smithy/liquid.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'smithy/liquid/database'
|
2
2
|
require 'smithy/liquid/rendering'
|
3
3
|
require 'smithy/liquid/filters/asset_tag'
|
4
|
+
require 'smithy/liquid/filters/smithy_helpers'
|
4
5
|
require 'smithy/liquid/filters/resize'
|
5
6
|
require 'smithy/liquid/filters/uri'
|
6
7
|
require 'smithy/liquid/tags/asset'
|
data/lib/smithy/version.rb
CHANGED
data/lib/smithy.rb
CHANGED
@@ -9,13 +9,12 @@ require 'smithy/liquid'
|
|
9
9
|
require 'smithy/formatter'
|
10
10
|
#
|
11
11
|
require 'smithy/content_blocks'
|
12
|
+
require 'smithy/content_resources'
|
12
13
|
|
13
14
|
module Smithy
|
14
|
-
|
15
15
|
def self.log(*args)
|
16
16
|
level = args.size == 1 ? 'info' : args.first
|
17
17
|
message = args.size == 1 ? args.first : args.last
|
18
18
|
::Smithy::Logger.send(level.to_sym, message)
|
19
19
|
end
|
20
|
-
|
21
20
|
end
|
Binary file
|