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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39561e91c08df383f68cdd2ab7ff4696f4ece727
|
4
|
+
data.tar.gz: ab0a854d38401f183bec49e954983aac63967480
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31cd8bf890e4e25f63b3f57d03ad46c7fa5ee7d9da10959b9ee16cda5d2296a71982540c015b8188b4dbc909e814e1051e570f1b7b4394b132d807a67cad36ef
|
7
|
+
data.tar.gz: badd9f440124104d63627981895dc5828621ca9804ee47ef04b4bdbe2579e68d78a78d8a4bfc1c635661a72e08a2f39ae55fd0edfcb6bc2fac5d60566e25cc4d
|
@@ -4,14 +4,15 @@
|
|
4
4
|
jQuery ->
|
5
5
|
$('#fileupload').fileupload
|
6
6
|
add: (e, data) ->
|
7
|
-
types = /(\.|\/)(gif|jpe?g|png|pdf)$/i
|
7
|
+
types = /(\.|\/)(gif|jpe?g|png|pdf|svgz?)$/i
|
8
8
|
file = data.files[0]
|
9
9
|
if types.test(file.type) || types.test(file.name)
|
10
10
|
data.context = $(tmpl("template-upload", file))
|
11
|
-
$('#
|
11
|
+
$(this).find('#Content-Type').val(file.type)
|
12
|
+
$(this).append(data.context)
|
12
13
|
data.submit()
|
13
14
|
else
|
14
|
-
alert("#{file.name} is not a gif, jpeg, png or pdf file")
|
15
|
+
alert("#{file.name} is not a gif, jpeg, png, svg or pdf file")
|
15
16
|
|
16
17
|
progress: (e, data) ->
|
17
18
|
if data.context
|
@@ -25,8 +26,9 @@ jQuery ->
|
|
25
26
|
to = $('#fileupload').data('post') + ".js"
|
26
27
|
content = {}
|
27
28
|
content[$('#fileupload').data('as')] = domain + path
|
28
|
-
|
29
|
-
|
29
|
+
setTimeout ->
|
30
|
+
$.post(to, content)
|
31
|
+
, 1500
|
30
32
|
data.context.remove() if data.context # remove progress bar
|
31
33
|
|
32
34
|
fail: (e, data) ->
|
@@ -0,0 +1,19 @@
|
|
1
|
+
//= depend_on_asset "ZeroClipboard.swf"
|
2
|
+
jQuery ->
|
3
|
+
|
4
|
+
ZeroClipboard.config({
|
5
|
+
swfPath: '<%= image_path "ZeroClipboard.swf" %>'
|
6
|
+
});
|
7
|
+
|
8
|
+
($ 'body').on "click", ".copy-to-clipboard", (e) ->
|
9
|
+
e.preventDefault()
|
10
|
+
$('.copy-to-clipboard').each ->
|
11
|
+
$link = ($ this)
|
12
|
+
clip = new ZeroClipboard( this )
|
13
|
+
clip.on "copy", (e) ->
|
14
|
+
clip.setText($link.data('clipboard-text'))
|
15
|
+
saved_text = $link.text()
|
16
|
+
$link.text 'Copied!'
|
17
|
+
setTimeout ->
|
18
|
+
$link.text(saved_text)
|
19
|
+
, 2000
|
@@ -1,17 +1,19 @@
|
|
1
1
|
var ace_edit = function(id, template_type, name) {
|
2
2
|
if (!name) { name = 'template_content' }
|
3
|
-
var
|
4
|
-
|
5
|
-
|
6
|
-
var
|
3
|
+
var textarea_id = name + '-' + id
|
4
|
+
var editor_id = name + '_editor-' + id
|
5
|
+
$('#'+editor_id).show();
|
6
|
+
var editor = ace.edit(editor_id);
|
7
|
+
var $textarea = $('#'+textarea_id);
|
8
|
+
$textarea.hide()
|
7
9
|
var session = editor.getSession();
|
8
10
|
session.setMode("ace/mode/" + template_type);
|
9
|
-
session.setValue(textarea.val());
|
11
|
+
session.setValue($textarea.val());
|
10
12
|
session.setTabSize(2);
|
11
13
|
session.setUseSoftTabs(true);
|
12
14
|
session.setUseWrapMode(true);
|
13
15
|
session.on('change', function(){
|
14
|
-
textarea.val(editor.getSession().getValue());
|
16
|
+
$textarea.val(editor.getSession().getValue());
|
15
17
|
});
|
16
18
|
editor.commands.addCommand({
|
17
19
|
name: 'save',
|
@@ -47,9 +47,9 @@ $(function() {
|
|
47
47
|
|
48
48
|
// replace the remover checkboxes with a link
|
49
49
|
$('form .destroy > label').hide();
|
50
|
-
$('form .destroy
|
50
|
+
$('form .destroy').each(function(i) {
|
51
51
|
link = $('<a href="javascript:void(0);" class="btn btn-danger btn-mini">Delete</a>').addClass("remove_nested_fields");
|
52
|
-
$(this).
|
52
|
+
$(this).append($(link));
|
53
53
|
});
|
54
54
|
|
55
55
|
});
|
@@ -17,9 +17,11 @@ module Smithy
|
|
17
17
|
def create
|
18
18
|
@asset = Asset.new(filtered_params)
|
19
19
|
@asset.save
|
20
|
-
flash.notice = "Your asset was created" if @asset.persisted?
|
21
20
|
respond_with @asset do |format|
|
22
|
-
format.html {
|
21
|
+
format.html {
|
22
|
+
flash.notice = "Your asset was created" if @asset.persisted?
|
23
|
+
redirect_to assets_path
|
24
|
+
}
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
data/app/controllers/smithy/{content_pieces_controller.rb → content_resources_controller.rb}
RENAMED
@@ -1,11 +1,12 @@
|
|
1
1
|
require_dependency "smithy/base_controller"
|
2
2
|
|
3
|
-
class Smithy::
|
3
|
+
class Smithy::ContentResourcesController < Smithy::BaseController
|
4
4
|
before_filter :set_controller_path
|
5
5
|
respond_to :html, :json
|
6
6
|
|
7
7
|
helper_method :accessible_attributes
|
8
8
|
helper_method :klass_name
|
9
|
+
helper_method :klass_table_name
|
9
10
|
helper_method :readable_attributes
|
10
11
|
|
11
12
|
def index
|
@@ -28,7 +29,7 @@ class Smithy::ContentPiecesController < Smithy::BaseController
|
|
28
29
|
@record.save
|
29
30
|
flash.notice = "Your #{klass_name} was created" if @record.persisted?
|
30
31
|
respond_with @record do |format|
|
31
|
-
format.html { @record.persisted? ? redirect_to(
|
32
|
+
format.html { @record.persisted? ? redirect_to(:action => :index) : render(:action => 'new') }
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
@@ -60,13 +61,17 @@ class Smithy::ContentPiecesController < Smithy::BaseController
|
|
60
61
|
|
61
62
|
def klass
|
62
63
|
# override to provide an object for each class
|
63
|
-
raise "You must inherit from this Smithy::
|
64
|
+
raise "You must inherit from this Smithy::ContentResourcesController and provide a private #klass method"
|
64
65
|
end
|
65
66
|
|
66
67
|
def klass_name
|
67
68
|
@klass_name ||= klass.name.sub(/^Smithy::/, '').titleize
|
68
69
|
end
|
69
70
|
|
71
|
+
def klass_table_name
|
72
|
+
klass.name.sub(/^Smithy::/, '').underscore.pluralize
|
73
|
+
end
|
74
|
+
|
70
75
|
def new_record
|
71
76
|
klass.new(filtered_params)
|
72
77
|
end
|
@@ -92,6 +97,6 @@ class Smithy::ContentPiecesController < Smithy::BaseController
|
|
92
97
|
end
|
93
98
|
|
94
99
|
def accessible_attributes
|
95
|
-
klass.
|
100
|
+
permitted_params.send("#{klass.name.sub(/^Smithy::/, '').underscore}_attributes".to_sym)
|
96
101
|
end
|
97
102
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Smithy
|
2
2
|
module ApplicationHelper
|
3
|
-
def
|
3
|
+
def smithy_link_to_add_fields(name, association, form_builder)
|
4
4
|
html = content_tag(:div, :id => "#{association}_fields_blueprint", :style => "display:none;") do
|
5
5
|
form_builder.semantic_fields_for(association, model_object(form_builder, association), :child_index => "new_#{association}") do |builder|
|
6
6
|
form_builder.template.concat(raw render("#{form_builder.object.class.to_s.tableize}/#{association.to_s.singularize}_fields", :f => builder))
|
@@ -10,7 +10,7 @@ module Smithy
|
|
10
10
|
form_builder.template.link_to(name, "javascript:void(0)", :class => "add_nested_fields", "data-association" => association)
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def smithy_link_to_remove_fields(name, form_builder)
|
14
14
|
form_builder.hidden_field(:_destroy) + @template.link_to(name, "javascript:void(0)", :class => "remove_nested_fields")
|
15
15
|
end
|
16
16
|
|
@@ -1,4 +1,16 @@
|
|
1
1
|
module Smithy
|
2
2
|
module TemplatesHelper
|
3
|
+
include Smithy::Liquid::Rendering
|
4
|
+
|
5
|
+
def render_smithy_nav(options="")
|
6
|
+
context = ::Liquid::Context.new({}, smithy_default_assigns, smithy_default_registers, false)
|
7
|
+
::Liquid::Template.parse("{% nav #{options} %}").render(liquid_context)
|
8
|
+
end
|
9
|
+
|
10
|
+
def render_smithy_partial(partial_name)
|
11
|
+
partial_template = Smithy::Template.partials.find_by_name(partial_name)
|
12
|
+
return if partial_template.blank?
|
13
|
+
partial_template.liquid_template.render(liquid_context)
|
14
|
+
end
|
3
15
|
end
|
4
16
|
end
|
@@ -65,6 +65,7 @@ module Smithy
|
|
65
65
|
:policy => policy,
|
66
66
|
:signature => signature,
|
67
67
|
"AWSAccessKeyId" => @options[:aws_access_key_id],
|
68
|
+
"Content-Type" => nil
|
68
69
|
}
|
69
70
|
end
|
70
71
|
|
@@ -86,6 +87,7 @@ module Smithy
|
|
86
87
|
conditions: [
|
87
88
|
["starts-with", "$utf8", ""],
|
88
89
|
["starts-with", "$key", ""],
|
90
|
+
["starts-with", "$Content-Type", ""],
|
89
91
|
["content-length-range", 0, @options[:max_file_size]],
|
90
92
|
{bucket: @options[:bucket]},
|
91
93
|
{acl: @options[:acl]}
|
data/app/models/smithy/asset.rb
CHANGED
@@ -29,6 +29,8 @@ module Smithy
|
|
29
29
|
case ext
|
30
30
|
when 'jpg', 'jpeg', 'gif', 'png'
|
31
31
|
:image
|
32
|
+
when 'svg', 'svgz'
|
33
|
+
:direct_image
|
32
34
|
when 'pdf'
|
33
35
|
:pdf
|
34
36
|
when 'doc', 'docx'
|
@@ -70,7 +72,8 @@ module Smithy
|
|
70
72
|
# assuming that jquery-upload and dragonfly are using the same data storage...
|
71
73
|
def set_file_uid_manually
|
72
74
|
if self.uploaded_file_url? # this means it was uploaded via jquery-upload
|
73
|
-
|
75
|
+
uri = URI.parse(URI.encode(self.uploaded_file_url))
|
76
|
+
self.file_uid = self.uploaded_file_url.sub("#{uri.scheme}://#{uri.host}/", '')
|
74
77
|
self.uploaded_file_url = nil
|
75
78
|
end
|
76
79
|
end
|
data/app/models/smithy/page.rb
CHANGED
data/app/models/smithy/site.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<% flash.each do |name, msg| %>
|
2
|
-
<div class="alert alert-<%= name == :notice ? "success" : "
|
2
|
+
<div class="alert alert-<%= name == :notice ? "success" : "warning" %>">
|
3
3
|
<button type="button" class="close" data-dismiss="alert">×</button>
|
4
4
|
<%= msg %>
|
5
5
|
</div>
|
@@ -15,6 +15,9 @@
|
|
15
15
|
<ul class="nav navbar-nav">
|
16
16
|
<li><%= link_to "<i class=\"fa fa-sitemap\"></i> Manage Content".html_safe, pages_path %></li>
|
17
17
|
<li><%= link_to "<i class=\"fa fa-file\"></i> Images & Files".html_safe, assets_path %></li>
|
18
|
+
<% Smithy::ContentResources::Registry.content_resources.each do |controller_name, title| %>
|
19
|
+
<li><%= link_to title, controller_name.to_sym %></li>
|
20
|
+
<% end %>
|
18
21
|
</ul>
|
19
22
|
<ul class="nav navbar-nav navbar-right">
|
20
23
|
<li><%= link_to "<i class=\"fa fa-arrow-right\"></i> View Site".html_safe, root_path %></li>
|
@@ -23,7 +26,7 @@
|
|
23
26
|
<ul class="dropdown-menu">
|
24
27
|
<li><%= link_to "<i class=\"fa fa-book\"></i> Templates".html_safe, templates_path %></li>
|
25
28
|
<li><%= link_to "<i class=\"fa fa-list-alt\"></i> Content Blocks".html_safe, content_blocks_path %></li>
|
26
|
-
|
29
|
+
<% if self.respond_to?(:users_path) %><li><%= link_to users_path do %><i class="fa fa-user"></i> Users<% end %></li><% end %>
|
27
30
|
<li><%= link_to "<i class=\"fa fa-cog\"></i> Settings".html_safe, settings_path %></li>
|
28
31
|
<li><%= link_to "<i class=\"fa fa-refresh\"></i> Site Cache".html_safe, cache_path %></li>
|
29
32
|
</ul>
|
@@ -1,16 +1,19 @@
|
|
1
|
-
<
|
1
|
+
<div class="col-xs-6 col-md-3">
|
2
2
|
<div class="thumbnail clearfix">
|
3
|
-
<%= link_to asset
|
3
|
+
<%= link_to [:edit, asset] do %>
|
4
4
|
<% if asset.file_type == :image %>
|
5
|
-
<%= image_tag asset.file.thumb("
|
5
|
+
<%= image_tag asset.file.thumb("340x226#").url, width: 170, height: 114, alt: '' %>
|
6
|
+
<% elsif asset.file_type == :direct_image %>
|
7
|
+
<%= image_tag asset.file.remote_url, width: 170, alt: '' %>
|
6
8
|
<% else %>
|
7
9
|
<div style="width:170px;height:78px;padding-top:36px;text-align:center;"><%= image_tag file_type_icon(asset), alt: '' %></div>
|
8
10
|
<% end %>
|
9
11
|
<% end %>
|
10
12
|
<p class="name"><strong><%= asset.name %></strong></p>
|
11
13
|
<div class="pull-right">
|
12
|
-
<%= link_to "
|
14
|
+
<%= link_to "Copy URL", image_url(asset.file.url), class: "btn btn-primary btn-xs copy-to-clipboard", data: { 'clipboard-text' => image_url(asset.file.url) } %>
|
15
|
+
<%= link_to "Edit", [:edit, asset], class: "btn btn-primary btn-xs" %>
|
13
16
|
<%= link_to "Delete", asset, class: "btn btn-danger btn-xs", method: :delete, data: { confirm: "Are you sure?" } %>
|
14
17
|
</div>
|
15
18
|
</div>
|
16
|
-
</
|
19
|
+
</div>
|
@@ -5,12 +5,13 @@
|
|
5
5
|
<%= f.input :retained_file, :as => :hidden %>
|
6
6
|
<% if @asset.file %>
|
7
7
|
<div>
|
8
|
-
|
9
|
-
<% if asset.file_type == :image %>
|
8
|
+
<div><%= link_to "Copy URL", image_url(@asset.file.url), class: "btn btn-primary btn-xs copy-to-clipboard", data: { 'clipboard-text' => image_url(@asset.file.url) } %></div>
|
9
|
+
<% if @asset.file_type == :image %>
|
10
10
|
<img src="<%= @asset.file.thumb("300x300").url %>" alt="">
|
11
|
+
<% elsif @asset.file_type == :direct_image %>
|
12
|
+
<%= image_tag @asset.file.remote_url, width: 300, alt: '' %>
|
11
13
|
<% else %>
|
12
|
-
<%= image_tag file_type_icon(asset), alt: '' %>
|
13
|
-
<% end %>
|
14
|
+
<%= image_tag file_type_icon(@asset), alt: '' %>
|
14
15
|
<% end %>
|
15
16
|
</div>
|
16
17
|
<% end %>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<% if @asset.new_record? %>
|
2
2
|
alert("Failed to upload painting: <%= j @asset.errors.full_messages.join(', ').html_safe %>");
|
3
3
|
<% else %>
|
4
|
-
|
4
|
+
<%# re-find the asset to load up the proper paths %>
|
5
|
+
$("#asset-thumbnails").prepend("<%= j render(Smithy::Asset.find(@asset.id)) %>");
|
5
6
|
<% end %>
|
@@ -16,7 +16,7 @@
|
|
16
16
|
</dl>
|
17
17
|
<% end %>
|
18
18
|
|
19
|
-
<div><%=
|
19
|
+
<div><%= smithy_link_to_add_fields "Add a Template", :templates, f %></div>
|
20
20
|
<%= f.semantic_fields_for(:templates) do |builder| %>
|
21
21
|
<%= render partial: "template_fields", locals: { f: builder } %>
|
22
22
|
<% end %>
|
@@ -4,7 +4,12 @@
|
|
4
4
|
<%= f.inputs do %>
|
5
5
|
<%= f.inputs *accessible_attributes %>
|
6
6
|
<% end %>
|
7
|
-
<%= f.actions
|
7
|
+
<%= f.actions do %>
|
8
|
+
<%= link_to([ klass_table_name ], class: 'btn btn-default') do %>
|
9
|
+
<span class="fa fa-arrow-left"></span> <%= "Back to #{klass_name.pluralize}" %>
|
10
|
+
<% end %>
|
11
|
+
<%= f.action :submit %>
|
12
|
+
<% end %>
|
8
13
|
<% end %>
|
9
14
|
|
10
15
|
|
@@ -1,4 +1,7 @@
|
|
1
1
|
<% content_for :title, "#{klass_name}" %>
|
2
|
+
|
3
|
+
<%= content_tag :p, link_to("New #{klass_name}", [:new, klass_table_name.singularize ], class: 'btn btn-primary') %></p>
|
4
|
+
|
2
5
|
<table border="0" cellpadding="4" class="table table-hover table-bordered">
|
3
6
|
<thead>
|
4
7
|
<tr>
|
@@ -11,6 +14,7 @@
|
|
11
14
|
<tr>
|
12
15
|
<td>
|
13
16
|
<%= link_to "Edit", [:edit, record], :class => "btn btn-default btn-xs" %>
|
17
|
+
<%= link_to("Delete", record, method: :delete, data: { confirm: "Are you sure you want to delete this #{klass_name}?" }, class: 'btn btn-danger btn-xs') if record.persisted? %>
|
14
18
|
</td>
|
15
19
|
<%- readable_attributes.map(&:to_sym).each do |attribute| %>
|
16
20
|
<td><%= record[attribute] %></td>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% content_for :title, "New #{klass_name}" %>
|
2
|
+
|
3
|
+
<%= semantic_form_for @record do |f| %>
|
4
|
+
<%= f.inputs do %>
|
5
|
+
<%= f.inputs *accessible_attributes %>
|
6
|
+
<% end %>
|
7
|
+
<%= f.actions do %>
|
8
|
+
<%= link_to([ klass_table_name ], class: 'btn btn-default') do %>
|
9
|
+
<span class="fa fa-arrow-left"></span> <%= "Back to #{klass_name.pluralize}" %>
|
10
|
+
<% end %>
|
11
|
+
<%= f.action :submit %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
@@ -5,7 +5,6 @@
|
|
5
5
|
<% breadcrumbs.each do |p| %>
|
6
6
|
<li>
|
7
7
|
<%= @page == p ? p.title : link_to(p.title, edit_page_path(p.id)) %>
|
8
|
-
<%= content_tag :span, :class => 'divider' do %>/<% end %>
|
9
8
|
</li>
|
10
9
|
<% end %>
|
11
10
|
<%= content_tag(:li, @page.title) if @page.persisted? %>
|
@@ -42,7 +41,7 @@
|
|
42
41
|
<%= content_tag :div, :id => "page-seo", :class => "collapse" do %>
|
43
42
|
<%= f.inputs do %>
|
44
43
|
<%= f.input :browser_title %>
|
45
|
-
<%= f.input :keywords %>
|
44
|
+
<%= f.input :keywords, as: :string, input_html: { maxlength: nil } %>
|
46
45
|
<%= f.input :description %>
|
47
46
|
<% end %>
|
48
47
|
<% end %>
|
@@ -2,14 +2,12 @@ require 'dragonfly'
|
|
2
2
|
|
3
3
|
# Configure
|
4
4
|
Dragonfly.app.configure do
|
5
|
-
plugin :imagemagick
|
5
|
+
plugin :imagemagick,
|
6
|
+
convert_command: `which convert`.strip.presence || "/usr/local/bin/convert",
|
7
|
+
identify_command: `which identify`.strip.presence || "/usr/local/bin/identify"
|
6
8
|
|
7
|
-
verify_urls true
|
8
9
|
secret "7fb765cbc9f1d92d5d1a56a43193d34d4f9b54dced3e62cb4e42f25d2500dd0f"
|
9
10
|
|
10
|
-
convert_command = `which convert`.strip.presence || "/usr/local/bin/convert"
|
11
|
-
identify_command = `which identify`.strip.presence || "/usr/local/bin/identify"
|
12
|
-
|
13
11
|
url_format '/uploads/assets/:job/:name'
|
14
12
|
|
15
13
|
datastore Smithy::Asset.dragonfly_datastore
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module Smithy
|
4
|
+
module ContentResources
|
5
|
+
class Registry
|
6
|
+
@@content_resources = []
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def clear
|
10
|
+
@@content_resources = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def content_resources
|
14
|
+
@@content_resources
|
15
|
+
end
|
16
|
+
|
17
|
+
def register(content_resource_model_name, navigation_title=nil)
|
18
|
+
return if @@content_resources.include?(content_resource_model_name)
|
19
|
+
navigation_title ||= content_resource_model_name.to_s.titleize.pluralize
|
20
|
+
@@content_resources << [content_resource_model_name.to_s.tableize, navigation_title]
|
21
|
+
Smithy::Engine.routes.prepend do
|
22
|
+
scope '/smithy/content_resources' do
|
23
|
+
resources content_resource_model_name.to_s.tableize
|
24
|
+
end
|
25
|
+
end
|
26
|
+
@@content_resources
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/smithy/dependencies.rb
CHANGED
@@ -12,7 +12,7 @@ module Smithy
|
|
12
12
|
module ClassMethods
|
13
13
|
def content_types
|
14
14
|
{
|
15
|
-
:image => ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png', 'image/jpg', 'image/x-icon'],
|
15
|
+
:image => ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png', 'image/jpg', 'image/x-icon', 'image/svg+xml'],
|
16
16
|
:media => [/^video/, 'application/x-shockwave-flash', 'application/x-flash-video', 'application/x-swf', /^audio/, 'application/ogg', 'application/x-mp3'],
|
17
17
|
:pdf => ['application/pdf', 'application/x-pdf'],
|
18
18
|
:stylesheet => ['text/css'],
|
@@ -30,7 +30,7 @@ module Smithy
|
|
30
30
|
/#{ENV['AWS_S3_BUCKET']}\.s3\.amazonaws\.com/
|
31
31
|
]
|
32
32
|
end
|
33
|
-
::Dragonfly::S3DataStore.new(bucket_name: ENV['AWS_S3_BUCKET'], access_key_id: ENV['AWS_ACCESS_KEY_ID'], secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'])
|
33
|
+
::Dragonfly::S3DataStore.new(bucket_name: ENV['AWS_S3_BUCKET'], access_key_id: ENV['AWS_ACCESS_KEY_ID'], secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'], region: ENV['AWS_S3_REGION'], url_scheme: 'https')
|
34
34
|
else
|
35
35
|
Dragonfly.app.configure { fetch_url_whitelist [] }
|
36
36
|
::Dragonfly::FileDataStore.new(root_path: Rails.root.join('public/system/dragonfly', Rails.env), server_root: Rails.root.join('public'))
|
data/lib/smithy/engine.rb
CHANGED
@@ -24,6 +24,10 @@ module Smithy
|
|
24
24
|
g.helper false
|
25
25
|
end
|
26
26
|
|
27
|
+
initializer :assets do |config|
|
28
|
+
Rails.application.config.assets.precompile += %w( ZeroClipboard.swf )
|
29
|
+
end
|
30
|
+
|
27
31
|
config.after_initialize do
|
28
32
|
# We need to reload the routes here due to how Smithy sets them up.
|
29
33
|
# The different facets of Smithy (auth) append/prepend routes to Smithy
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Smithy
|
2
|
+
module Liquid
|
3
|
+
module Filters
|
4
|
+
module SmithyHelpers
|
5
|
+
def rails_helper(helper, *args)
|
6
|
+
options = args_to_options(args)
|
7
|
+
helper = helper.to_sym
|
8
|
+
return nil if !controller.view_context.respond_to?(helper)
|
9
|
+
if options.blank?
|
10
|
+
controller.view_context.public_send(helper)
|
11
|
+
else
|
12
|
+
controller.view_context.public_send(helper, options)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
protected
|
18
|
+
# Convert an array of properties ('key:value') into a hash
|
19
|
+
# Ex: ['width:50', 'height:100'] => { :width => '50', :height => '100' }
|
20
|
+
def args_to_options(*args)
|
21
|
+
options = {}
|
22
|
+
args.flatten.each do |a|
|
23
|
+
if (a =~ /^(.*):(.*)$/)
|
24
|
+
options[$1.to_sym] = $2
|
25
|
+
end
|
26
|
+
end
|
27
|
+
options
|
28
|
+
end
|
29
|
+
|
30
|
+
def context
|
31
|
+
context = self.instance_variable_get(:@context)
|
32
|
+
end
|
33
|
+
|
34
|
+
def controller
|
35
|
+
context.registers[:controller]
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
::Liquid::Template.register_filter(SmithyHelpers)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|