smithycms 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/assets/javascripts/smithy/application.js +6 -6
- data/app/assets/javascripts/smithy/nested_forms.js +1 -1
- data/app/controllers/smithy/page_contents_controller.rb +2 -0
- data/app/controllers/smithy/pages_controller.rb +5 -1
- data/app/models/smithy/image.rb +0 -1
- data/app/models/smithy/page.rb +1 -0
- data/app/models/smithy/page_content.rb +2 -1
- data/app/models/smithy/permitted_params.rb +6 -2
- data/app/models/smithy/site.rb +1 -1
- data/app/views/smithy/assets/_asset.html.erb +2 -2
- data/app/views/smithy/assets/_form.html.erb +2 -3
- data/app/views/smithy/content_blocks/edit.html.erb +4 -4
- data/app/views/smithy/content_pieces/edit.html.erb +1 -1
- data/app/views/smithy/images/_form_fields.html.erb +4 -4
- data/app/views/smithy/pages/_container.html.erb +4 -4
- data/app/views/smithy/pages/_page_related.html.erb +2 -1
- data/app/views/smithy/settings/_setting.html.erb +1 -1
- data/app/views/smithy/templates/edit.html.erb +2 -2
- data/config/initializers/dragonfly.rb +1 -1
- data/lib/smithy/content_blocks/model.rb +2 -1
- data/lib/smithy/liquid/drops/page.rb +32 -0
- data/lib/smithy/liquid/filters/asset_tag.rb +10 -2
- data/lib/smithy/liquid/filters/resize.rb +1 -1
- data/lib/smithy/liquid/tags/nav.rb +23 -8
- data/lib/smithy/version.rb +1 -1
- metadata +5 -255
- data/app/assets/javascripts/ace/ace.js +0 -11
- data/app/assets/javascripts/ace/ext-elastic_tabstops_lite.js +0 -1
- data/app/assets/javascripts/ace/ext-emmet.js +0 -1
- data/app/assets/javascripts/ace/ext-keybinding_menu.js +0 -1
- data/app/assets/javascripts/ace/ext-language_tools.js +0 -1
- data/app/assets/javascripts/ace/ext-modelist.js +0 -1
- data/app/assets/javascripts/ace/ext-options.js +0 -1
- data/app/assets/javascripts/ace/ext-searchbox.js +0 -1
- data/app/assets/javascripts/ace/ext-settings_menu.js +0 -1
- data/app/assets/javascripts/ace/ext-spellcheck.js +0 -1
- data/app/assets/javascripts/ace/ext-split.js +0 -1
- data/app/assets/javascripts/ace/ext-static_highlight.js +0 -1
- data/app/assets/javascripts/ace/ext-statusbar.js +0 -1
- data/app/assets/javascripts/ace/ext-textarea.js +0 -1
- data/app/assets/javascripts/ace/ext-themelist.js +0 -1
- data/app/assets/javascripts/ace/ext-whitespace.js +0 -1
- data/app/assets/javascripts/ace/keybinding-emacs.js +0 -1
- data/app/assets/javascripts/ace/keybinding-vim.js +0 -1
- data/app/assets/javascripts/ace/mode-abap.js +0 -1
- data/app/assets/javascripts/ace/mode-actionscript.js +0 -1
- data/app/assets/javascripts/ace/mode-ada.js +0 -1
- data/app/assets/javascripts/ace/mode-asciidoc.js +0 -1
- data/app/assets/javascripts/ace/mode-assembly_x86.js +0 -1
- data/app/assets/javascripts/ace/mode-autohotkey.js +0 -1
- data/app/assets/javascripts/ace/mode-batchfile.js +0 -1
- data/app/assets/javascripts/ace/mode-c9search.js +0 -1
- data/app/assets/javascripts/ace/mode-c_cpp.js +0 -1
- data/app/assets/javascripts/ace/mode-clojure.js +0 -1
- data/app/assets/javascripts/ace/mode-cobol.js +0 -1
- data/app/assets/javascripts/ace/mode-coffee.js +0 -1
- data/app/assets/javascripts/ace/mode-coldfusion.js +0 -1
- data/app/assets/javascripts/ace/mode-csharp.js +0 -1
- data/app/assets/javascripts/ace/mode-css.js +0 -1
- data/app/assets/javascripts/ace/mode-curly.js +0 -1
- data/app/assets/javascripts/ace/mode-d.js +0 -1
- data/app/assets/javascripts/ace/mode-dart.js +0 -1
- data/app/assets/javascripts/ace/mode-diff.js +0 -1
- data/app/assets/javascripts/ace/mode-django.js +0 -1
- data/app/assets/javascripts/ace/mode-dot.js +0 -1
- data/app/assets/javascripts/ace/mode-ejs.js +0 -1
- data/app/assets/javascripts/ace/mode-erlang.js +0 -1
- data/app/assets/javascripts/ace/mode-forth.js +0 -1
- data/app/assets/javascripts/ace/mode-ftl.js +0 -1
- data/app/assets/javascripts/ace/mode-glsl.js +0 -1
- data/app/assets/javascripts/ace/mode-golang.js +0 -1
- data/app/assets/javascripts/ace/mode-groovy.js +0 -1
- data/app/assets/javascripts/ace/mode-haml.js +0 -1
- data/app/assets/javascripts/ace/mode-haskell.js +0 -1
- data/app/assets/javascripts/ace/mode-haxe.js +0 -1
- data/app/assets/javascripts/ace/mode-html.js +0 -1
- data/app/assets/javascripts/ace/mode-html_ruby.js +0 -1
- data/app/assets/javascripts/ace/mode-ini.js +0 -1
- data/app/assets/javascripts/ace/mode-jade.js +0 -1
- data/app/assets/javascripts/ace/mode-java.js +0 -1
- data/app/assets/javascripts/ace/mode-javascript.js +0 -1
- data/app/assets/javascripts/ace/mode-json.js +0 -1
- data/app/assets/javascripts/ace/mode-jsoniq.js +0 -1
- data/app/assets/javascripts/ace/mode-jsp.js +0 -1
- data/app/assets/javascripts/ace/mode-jsx.js +0 -1
- data/app/assets/javascripts/ace/mode-julia.js +0 -1
- data/app/assets/javascripts/ace/mode-latex.js +0 -1
- data/app/assets/javascripts/ace/mode-less.js +0 -1
- data/app/assets/javascripts/ace/mode-liquid.js +0 -1
- data/app/assets/javascripts/ace/mode-lisp.js +0 -1
- data/app/assets/javascripts/ace/mode-livescript.js +0 -1
- data/app/assets/javascripts/ace/mode-logiql.js +0 -1
- data/app/assets/javascripts/ace/mode-lsl.js +0 -1
- data/app/assets/javascripts/ace/mode-lua.js +0 -1
- data/app/assets/javascripts/ace/mode-luapage.js +0 -1
- data/app/assets/javascripts/ace/mode-lucene.js +0 -1
- data/app/assets/javascripts/ace/mode-makefile.js +0 -1
- data/app/assets/javascripts/ace/mode-markdown.js +0 -1
- data/app/assets/javascripts/ace/mode-matlab.js +0 -1
- data/app/assets/javascripts/ace/mode-mushcode.js +0 -1
- data/app/assets/javascripts/ace/mode-mushcode_high_rules.js +0 -1
- data/app/assets/javascripts/ace/mode-mysql.js +0 -1
- data/app/assets/javascripts/ace/mode-objectivec.js +0 -1
- data/app/assets/javascripts/ace/mode-ocaml.js +0 -1
- data/app/assets/javascripts/ace/mode-pascal.js +0 -1
- data/app/assets/javascripts/ace/mode-perl.js +0 -1
- data/app/assets/javascripts/ace/mode-pgsql.js +0 -1
- data/app/assets/javascripts/ace/mode-php.js +0 -1
- data/app/assets/javascripts/ace/mode-plain_text.js +0 -1
- data/app/assets/javascripts/ace/mode-powershell.js +0 -1
- data/app/assets/javascripts/ace/mode-prolog.js +0 -1
- data/app/assets/javascripts/ace/mode-properties.js +0 -1
- data/app/assets/javascripts/ace/mode-python.js +0 -1
- data/app/assets/javascripts/ace/mode-r.js +0 -1
- data/app/assets/javascripts/ace/mode-rdoc.js +0 -1
- data/app/assets/javascripts/ace/mode-rhtml.js +0 -1
- data/app/assets/javascripts/ace/mode-ruby.js +0 -1
- data/app/assets/javascripts/ace/mode-rust.js +0 -1
- data/app/assets/javascripts/ace/mode-sass.js +0 -1
- data/app/assets/javascripts/ace/mode-scad.js +0 -1
- data/app/assets/javascripts/ace/mode-scala.js +0 -1
- data/app/assets/javascripts/ace/mode-scheme.js +0 -1
- data/app/assets/javascripts/ace/mode-scss.js +0 -1
- data/app/assets/javascripts/ace/mode-sh.js +0 -1
- data/app/assets/javascripts/ace/mode-snippets.js +0 -1
- data/app/assets/javascripts/ace/mode-sql.js +0 -1
- data/app/assets/javascripts/ace/mode-stylus.js +0 -1
- data/app/assets/javascripts/ace/mode-svg.js +0 -1
- data/app/assets/javascripts/ace/mode-tcl.js +0 -1
- data/app/assets/javascripts/ace/mode-tex.js +0 -1
- data/app/assets/javascripts/ace/mode-text.js +0 -0
- data/app/assets/javascripts/ace/mode-textile.js +0 -1
- data/app/assets/javascripts/ace/mode-tmsnippet.js +0 -1
- data/app/assets/javascripts/ace/mode-toml.js +0 -1
- data/app/assets/javascripts/ace/mode-twig.js +0 -1
- data/app/assets/javascripts/ace/mode-typescript.js +0 -1
- data/app/assets/javascripts/ace/mode-vbscript.js +0 -1
- data/app/assets/javascripts/ace/mode-velocity.js +0 -1
- data/app/assets/javascripts/ace/mode-verilog.js +0 -1
- data/app/assets/javascripts/ace/mode-xml.js +0 -1
- data/app/assets/javascripts/ace/mode-xquery.js +0 -1
- data/app/assets/javascripts/ace/mode-yaml.js +0 -1
- data/app/assets/javascripts/ace/snippets/abap.js +0 -1
- data/app/assets/javascripts/ace/snippets/actionscript.js +0 -1
- data/app/assets/javascripts/ace/snippets/ada.js +0 -1
- data/app/assets/javascripts/ace/snippets/asciidoc.js +0 -1
- data/app/assets/javascripts/ace/snippets/assembly_x86.js +0 -1
- data/app/assets/javascripts/ace/snippets/autohotkey.js +0 -1
- data/app/assets/javascripts/ace/snippets/batchfile.js +0 -1
- data/app/assets/javascripts/ace/snippets/c9search.js +0 -1
- data/app/assets/javascripts/ace/snippets/c_cpp.js +0 -1
- data/app/assets/javascripts/ace/snippets/clojure.js +0 -1
- data/app/assets/javascripts/ace/snippets/cobol.js +0 -1
- data/app/assets/javascripts/ace/snippets/coffee.js +0 -1
- data/app/assets/javascripts/ace/snippets/coldfusion.js +0 -1
- data/app/assets/javascripts/ace/snippets/csharp.js +0 -1
- data/app/assets/javascripts/ace/snippets/css.js +0 -1
- data/app/assets/javascripts/ace/snippets/curly.js +0 -1
- data/app/assets/javascripts/ace/snippets/d.js +0 -1
- data/app/assets/javascripts/ace/snippets/dart.js +0 -1
- data/app/assets/javascripts/ace/snippets/diff.js +0 -1
- data/app/assets/javascripts/ace/snippets/django.js +0 -1
- data/app/assets/javascripts/ace/snippets/dot.js +0 -1
- data/app/assets/javascripts/ace/snippets/ejs.js +0 -1
- data/app/assets/javascripts/ace/snippets/erlang.js +0 -1
- data/app/assets/javascripts/ace/snippets/forth.js +0 -1
- data/app/assets/javascripts/ace/snippets/ftl.js +0 -1
- data/app/assets/javascripts/ace/snippets/glsl.js +0 -1
- data/app/assets/javascripts/ace/snippets/golang.js +0 -1
- data/app/assets/javascripts/ace/snippets/groovy.js +0 -1
- data/app/assets/javascripts/ace/snippets/haml.js +0 -1
- data/app/assets/javascripts/ace/snippets/haskell.js +0 -1
- data/app/assets/javascripts/ace/snippets/haxe.js +0 -1
- data/app/assets/javascripts/ace/snippets/html.js +0 -1
- data/app/assets/javascripts/ace/snippets/html_ruby.js +0 -1
- data/app/assets/javascripts/ace/snippets/ini.js +0 -1
- data/app/assets/javascripts/ace/snippets/jade.js +0 -1
- data/app/assets/javascripts/ace/snippets/java.js +0 -1
- data/app/assets/javascripts/ace/snippets/javascript.js +0 -1
- data/app/assets/javascripts/ace/snippets/json.js +0 -1
- data/app/assets/javascripts/ace/snippets/jsoniq.js +0 -1
- data/app/assets/javascripts/ace/snippets/jsp.js +0 -1
- data/app/assets/javascripts/ace/snippets/jsx.js +0 -1
- data/app/assets/javascripts/ace/snippets/julia.js +0 -1
- data/app/assets/javascripts/ace/snippets/latex.js +0 -1
- data/app/assets/javascripts/ace/snippets/less.js +0 -1
- data/app/assets/javascripts/ace/snippets/liquid.js +0 -1
- data/app/assets/javascripts/ace/snippets/lisp.js +0 -1
- data/app/assets/javascripts/ace/snippets/livescript.js +0 -1
- data/app/assets/javascripts/ace/snippets/logiql.js +0 -1
- data/app/assets/javascripts/ace/snippets/lsl.js +0 -1
- data/app/assets/javascripts/ace/snippets/lua.js +0 -1
- data/app/assets/javascripts/ace/snippets/luapage.js +0 -1
- data/app/assets/javascripts/ace/snippets/lucene.js +0 -1
- data/app/assets/javascripts/ace/snippets/makefile.js +0 -1
- data/app/assets/javascripts/ace/snippets/markdown.js +0 -1
- data/app/assets/javascripts/ace/snippets/matlab.js +0 -1
- data/app/assets/javascripts/ace/snippets/mushcode.js +0 -1
- data/app/assets/javascripts/ace/snippets/mushcode_high_rules.js +0 -1
- data/app/assets/javascripts/ace/snippets/mysql.js +0 -1
- data/app/assets/javascripts/ace/snippets/objectivec.js +0 -1
- data/app/assets/javascripts/ace/snippets/ocaml.js +0 -1
- data/app/assets/javascripts/ace/snippets/pascal.js +0 -1
- data/app/assets/javascripts/ace/snippets/perl.js +0 -1
- data/app/assets/javascripts/ace/snippets/pgsql.js +0 -1
- data/app/assets/javascripts/ace/snippets/php.js +0 -1
- data/app/assets/javascripts/ace/snippets/plain_text.js +0 -1
- data/app/assets/javascripts/ace/snippets/powershell.js +0 -1
- data/app/assets/javascripts/ace/snippets/prolog.js +0 -1
- data/app/assets/javascripts/ace/snippets/properties.js +0 -1
- data/app/assets/javascripts/ace/snippets/python.js +0 -1
- data/app/assets/javascripts/ace/snippets/r.js +0 -1
- data/app/assets/javascripts/ace/snippets/rdoc.js +0 -1
- data/app/assets/javascripts/ace/snippets/rhtml.js +0 -1
- data/app/assets/javascripts/ace/snippets/ruby.js +0 -1
- data/app/assets/javascripts/ace/snippets/rust.js +0 -1
- data/app/assets/javascripts/ace/snippets/sass.js +0 -1
- data/app/assets/javascripts/ace/snippets/scad.js +0 -1
- data/app/assets/javascripts/ace/snippets/scala.js +0 -1
- data/app/assets/javascripts/ace/snippets/scheme.js +0 -1
- data/app/assets/javascripts/ace/snippets/scss.js +0 -1
- data/app/assets/javascripts/ace/snippets/sh.js +0 -1
- data/app/assets/javascripts/ace/snippets/snippets.js +0 -1
- data/app/assets/javascripts/ace/snippets/sql.js +0 -1
- data/app/assets/javascripts/ace/snippets/stylus.js +0 -1
- data/app/assets/javascripts/ace/snippets/svg.js +0 -1
- data/app/assets/javascripts/ace/snippets/tcl.js +0 -1
- data/app/assets/javascripts/ace/snippets/tex.js +0 -1
- data/app/assets/javascripts/ace/snippets/text.js +0 -1
- data/app/assets/javascripts/ace/snippets/textile.js +0 -1
- data/app/assets/javascripts/ace/snippets/toml.js +0 -1
- data/app/assets/javascripts/ace/snippets/twig.js +0 -1
- data/app/assets/javascripts/ace/snippets/typescript.js +0 -1
- data/app/assets/javascripts/ace/snippets/vbscript.js +0 -1
- data/app/assets/javascripts/ace/snippets/velocity.js +0 -1
- data/app/assets/javascripts/ace/snippets/verilog.js +0 -1
- data/app/assets/javascripts/ace/snippets/xml.js +0 -1
- data/app/assets/javascripts/ace/snippets/xquery.js +0 -1
- data/app/assets/javascripts/ace/snippets/yaml.js +0 -1
- data/app/assets/javascripts/ace/theme-ambiance.js +0 -1
- data/app/assets/javascripts/ace/theme-chaos.js +0 -1
- data/app/assets/javascripts/ace/theme-chrome.js +0 -1
- data/app/assets/javascripts/ace/theme-clouds.js +0 -1
- data/app/assets/javascripts/ace/theme-clouds_midnight.js +0 -1
- data/app/assets/javascripts/ace/theme-cobalt.js +0 -1
- data/app/assets/javascripts/ace/theme-crimson_editor.js +0 -1
- data/app/assets/javascripts/ace/theme-dawn.js +0 -1
- data/app/assets/javascripts/ace/theme-dreamweaver.js +0 -1
- data/app/assets/javascripts/ace/theme-eclipse.js +0 -1
- data/app/assets/javascripts/ace/theme-github.js +0 -1
- data/app/assets/javascripts/ace/theme-idle_fingers.js +0 -1
- data/app/assets/javascripts/ace/theme-kr.js +0 -1
- data/app/assets/javascripts/ace/theme-merbivore.js +0 -1
- data/app/assets/javascripts/ace/theme-merbivore_soft.js +0 -1
- data/app/assets/javascripts/ace/theme-mono_industrial.js +0 -1
- data/app/assets/javascripts/ace/theme-monokai.js +0 -1
- data/app/assets/javascripts/ace/theme-pastel_on_dark.js +0 -1
- data/app/assets/javascripts/ace/theme-solarized_dark.js +0 -1
- data/app/assets/javascripts/ace/theme-solarized_light.js +0 -1
- data/app/assets/javascripts/ace/theme-terminal.js +0 -1
- data/app/assets/javascripts/ace/theme-textmate.js +0 -1
- data/app/assets/javascripts/ace/theme-tomorrow.js +0 -1
- data/app/assets/javascripts/ace/theme-tomorrow_night.js +0 -1
- data/app/assets/javascripts/ace/theme-tomorrow_night_blue.js +0 -1
- data/app/assets/javascripts/ace/theme-tomorrow_night_bright.js +0 -1
- data/app/assets/javascripts/ace/theme-tomorrow_night_eighties.js +0 -1
- data/app/assets/javascripts/ace/theme-twilight.js +0 -1
- data/app/assets/javascripts/ace/theme-vibrant_ink.js +0 -1
- data/app/assets/javascripts/ace/theme-xcode.js +0 -1
- data/app/assets/javascripts/ace/worker-coffee.js +0 -1
- data/app/assets/javascripts/ace/worker-css.js +0 -1
- data/app/assets/javascripts/ace/worker-javascript.js +0 -1
- data/app/assets/javascripts/ace/worker-json.js +0 -1
- data/app/assets/javascripts/ace/worker-lua.js +0 -1
- data/app/assets/javascripts/ace/worker-php.js +0 -1
- data/app/assets/javascripts/ace/worker-xquery.js +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f6c0427e4a30c1d753bcd02f46771123d83b945
|
4
|
+
data.tar.gz: 229c35d059afad3e7586d7d28cd9a34b52340288
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2448ff969ad38a466e2b04bea3a767a9b6b92575777234be1185b98bbff2a62b88c66ca92600ec84ccc2949042cc9d70388fd3c2ae9766b64b971cf34fcdbdfd
|
7
|
+
data.tar.gz: 5e8fda95465b163f34df96c0bfd8fe229852f2551bb0e9e155865aa7b6ece0d500a14e1bce20bdedd9a3c4855cacc55d91b69adff85519fc017f221177954985
|
data/README.md
CHANGED
@@ -19,11 +19,11 @@ A "Content Block" is simply an ActiveRecord model with a Smithy inclusion (<code
|
|
19
19
|
To get started, add this to your Gemfile
|
20
20
|
|
21
21
|
```ruby
|
22
|
-
gem '
|
22
|
+
gem 'smithycms'
|
23
23
|
```
|
24
24
|
|
25
25
|
If you need basic authentication and don't want to integrate with existing auth in your system, add this to your Gemfile too:
|
26
|
-
gem '
|
26
|
+
gem 'smithycms-auth'
|
27
27
|
|
28
28
|
Installing the CMS is simple, you can just
|
29
29
|
|
@@ -4,10 +4,10 @@
|
|
4
4
|
//= require jquery-fileupload/basic
|
5
5
|
//= require jquery-fileupload/vendor/tmpl
|
6
6
|
//= require bootstrap
|
7
|
-
//= require ace/ace
|
8
|
-
//= require ace/mode-css.js
|
9
|
-
//= require ace/mode-html.js
|
10
|
-
//= require ace/mode-javascript.js
|
11
|
-
//= require ace/mode-liquid.js
|
12
|
-
//= require ace/mode-markdown.js
|
7
|
+
//= require ace-1.1.3/ace
|
8
|
+
//= require ace-1.1.3/mode-css.js
|
9
|
+
//= require ace-1.1.3/mode-html.js
|
10
|
+
//= require ace-1.1.3/mode-javascript.js
|
11
|
+
//= require ace-1.1.3/mode-liquid.js
|
12
|
+
//= require ace-1.1.3/mode-markdown.js
|
13
13
|
//= require_tree .
|
@@ -19,6 +19,7 @@ module Smithy
|
|
19
19
|
# see PageContent#content_block_attributes=
|
20
20
|
@page_content.content_block_type = filtered_params[:content_block_type]
|
21
21
|
@page_content.attributes = filtered_params
|
22
|
+
# @page_content.content_block_attributes = params[:page_content][:content_block_attributes] if params[:page_content][:content_block_attributes]
|
22
23
|
@page_content.page = @page
|
23
24
|
@page_content.save
|
24
25
|
respond_with @page_content do |format|
|
@@ -32,6 +33,7 @@ module Smithy
|
|
32
33
|
|
33
34
|
def update
|
34
35
|
@page_content = Smithy::PageContent.find(params[:id])
|
36
|
+
# @page_content.content_block_attributes = params[:page_content][:content_block_attributes]
|
35
37
|
@saved = @page_content.update_attributes(filtered_params)
|
36
38
|
flash.notice = "Your content was saved" if @saved
|
37
39
|
respond_with @page_content do |format|
|
@@ -78,7 +78,11 @@ module Smithy
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def load_page_from_path
|
81
|
-
|
81
|
+
if smithy_current_user
|
82
|
+
@page = Page.friendly.find(page_path)
|
83
|
+
else
|
84
|
+
@page = Page.published.friendly.find(page_path)
|
85
|
+
end
|
82
86
|
redirect_to @page.external_link and return false if @page.external_link?
|
83
87
|
end
|
84
88
|
|
data/app/models/smithy/image.rb
CHANGED
data/app/models/smithy/page.rb
CHANGED
@@ -18,6 +18,7 @@ module Smithy
|
|
18
18
|
accepts_nested_attributes_for :contents, :reject_if => lambda {|a| a['label'].blank? || a['container'].blank? || a['content_block'].blank? }, :allow_destroy => true
|
19
19
|
|
20
20
|
scope :included_in_navigation, -> { where("show_in_navigation=? AND published_at <= ?", true, Time.now) }
|
21
|
+
scope :published, -> { where('published_at <= ?', Time.now) }
|
21
22
|
|
22
23
|
attr_accessor :publish
|
23
24
|
|
@@ -5,7 +5,7 @@ module Smithy
|
|
5
5
|
validates_presence_of :label, :container, :page
|
6
6
|
|
7
7
|
belongs_to :page, :touch => true
|
8
|
-
belongs_to :content_block, :polymorphic => true
|
8
|
+
belongs_to :content_block, :polymorphic => true, :dependent => :destroy
|
9
9
|
belongs_to :content_block_template
|
10
10
|
|
11
11
|
before_update :set_publishable
|
@@ -22,6 +22,7 @@ module Smithy
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def content_block_attributes=(attributes)
|
25
|
+
return unless attributes.present?
|
25
26
|
klass = content_block_type.safe_constantize || "Smithy::#{content_block_type}".safe_constantize
|
26
27
|
if klass
|
27
28
|
self.content_block = klass.find_or_initialize_by_id(attributes.delete(:id))
|
@@ -5,6 +5,8 @@ module Smithy
|
|
5
5
|
attributes = send("#{param.to_s}_attributes".to_sym)
|
6
6
|
if attributes == :all
|
7
7
|
params.fetch(param, {}).permit!
|
8
|
+
elsif attributes.respond_to? :call
|
9
|
+
attributes.call
|
8
10
|
else
|
9
11
|
params.fetch(param, {}).permit( *attributes )
|
10
12
|
end
|
@@ -19,7 +21,8 @@ module Smithy
|
|
19
21
|
end
|
20
22
|
|
21
23
|
def content_block_attributes
|
22
|
-
[ :name, :
|
24
|
+
# [ :name, templates_attributes: [ :id, :name, :content, :_destroy ] ]
|
25
|
+
:all
|
23
26
|
end
|
24
27
|
|
25
28
|
def content_block_template_attributes
|
@@ -35,7 +38,8 @@ module Smithy
|
|
35
38
|
end
|
36
39
|
|
37
40
|
def page_content_attributes
|
38
|
-
[ :label, :container, :content_block_type, :
|
41
|
+
# [ :label, :container, :content_block_type, :content_block_template_id, :position ]
|
42
|
+
:all
|
39
43
|
end
|
40
44
|
|
41
45
|
def page_list_attributes
|
data/app/models/smithy/site.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
<%= link_to "<img src=\"#{asset.file.thumb("170x114#").url}\" width=\"170\" height=\"114\" alt=\"\">".html_safe, asset.file.url %>
|
4
4
|
<p class="name"><strong><%= asset.name %></strong></p>
|
5
5
|
<div class="pull-right">
|
6
|
-
<%= link_to "Edit", [:edit, asset], :
|
7
|
-
<%= link_to "Delete", asset, :
|
6
|
+
<%= link_to "Edit", [:edit, asset], class: "btn btn-mini" %>
|
7
|
+
<%= link_to "Delete", asset, class: "btn btn-mini btn-danger", method: :delete, data: { confirm: "Are you sure?" } %>
|
8
8
|
</div>
|
9
9
|
</div>
|
10
10
|
</li>
|
@@ -4,9 +4,8 @@
|
|
4
4
|
<%= f.input :file, :as => :file %>
|
5
5
|
<%= f.input :retained_file, :as => :hidden %>
|
6
6
|
<% if @asset.file %>
|
7
|
-
<div>
|
8
|
-
|
9
|
-
</div>
|
7
|
+
<div><img src="<%= @asset.file.thumb("300x300").url %>" alt=""></div>
|
8
|
+
<div><%= link_to @asset.file.remote_url, @asset.file.remote_url %></div>
|
10
9
|
<% end %>
|
11
10
|
<% end %>
|
12
11
|
<%= f.actions :submit %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% content_for :title, "Content Blocks" %>
|
2
2
|
|
3
|
-
<%= render :
|
3
|
+
<%= render partial: "secondary_nav" %>
|
4
4
|
|
5
5
|
<%= semantic_form_for @content_block do |f| %>
|
6
6
|
<%= f.inputs do %>
|
@@ -18,14 +18,14 @@
|
|
18
18
|
|
19
19
|
<div><%= link_to_add_fields "Add a Template", :templates, f %></div>
|
20
20
|
<%= f.semantic_fields_for(:templates) do |builder| %>
|
21
|
-
<%= render :
|
21
|
+
<%= render partial: "template_fields", locals: { f: builder } %>
|
22
22
|
<% end %>
|
23
23
|
|
24
24
|
<%= f.actions do %>
|
25
|
-
<%= f.action :submit, :
|
25
|
+
<%= f.action :submit, label: "Save this Content Block" %>
|
26
26
|
<% end %>
|
27
27
|
<% end %>
|
28
28
|
|
29
29
|
<% content_for :related do %>
|
30
|
-
<p><%= link_to "Delete Content Block", @content_block, :
|
30
|
+
<p><%= link_to "Delete Content Block", @content_block, method: :delete, data: { confirm: "Are you sure you want to delete this Content Block?" }, class: 'btn btn-danger' %></p>
|
31
31
|
<% end %>
|
@@ -9,5 +9,5 @@
|
|
9
9
|
|
10
10
|
|
11
11
|
<% content_for :related do %>
|
12
|
-
<%= content_tag :p, link_to("Delete #{klass_name}", @record, :
|
12
|
+
<%= content_tag :p, link_to("Delete #{klass_name}", @record, method: :delete, data: { confirm: "Are you sure you want to delete this #{klass_name}?" }, class: 'btn btn-danger') if @record.persisted? %></p>
|
13
13
|
<% end %>
|
@@ -2,9 +2,12 @@
|
|
2
2
|
<%= f.input :asset, :collection => Smithy::Asset.order(:name) %>
|
3
3
|
<%= f.input :alternate_text %>
|
4
4
|
<% end %>
|
5
|
+
<%= f.inputs "Linked Image (optional)" do %>
|
6
|
+
<%= f.input :link_url %>
|
7
|
+
<% end %>
|
5
8
|
<%= f.inputs "Content (optional)" do %>
|
6
9
|
<%= f.input :content, :as => :text, :input_html => { :class => "span12", :id => "image_content-#{f.object.id || 'new'}" }, :hint => "Use markdown syntax for formatting. You can also use HTML directly. <a href=\"#{guide_path('markdown')}\" data-toggle=\"remote-load\" data-target=\"#content-guide\">See our markdown syntax reference</a>".html_safe %>
|
7
|
-
<div id="image_content_editor-<%= f.object.id || 'new' %>" class="
|
10
|
+
<div id="image_content_editor-<%= f.object.id || 'new' %>" class="ace_editor"></div>
|
8
11
|
<div id="content-guide"></div>
|
9
12
|
<% end %>
|
10
13
|
|
@@ -20,9 +23,6 @@
|
|
20
23
|
<%= f.input :height %>
|
21
24
|
<%= f.input :image_scaling, :as => :select, :collection => Smithy::Image.image_scaling_options %>
|
22
25
|
<% end %>
|
23
|
-
<%= f.inputs "Linked Image (optional)" do %>
|
24
|
-
<%= f.input :link_url %>
|
25
|
-
<% end %>
|
26
26
|
<%= f.inputs "HTML Attributes (optional)" do %>
|
27
27
|
<%= f.input :html_attributes %>
|
28
28
|
<% end %>
|
@@ -5,20 +5,20 @@
|
|
5
5
|
<%= content_tag_for :tr, page_content do %>
|
6
6
|
<td>
|
7
7
|
<i class="icon-reorder handle"></i>
|
8
|
-
<%= link_to "edit", edit_page_content_path(@page.id, page_content), :
|
8
|
+
<%= link_to "edit", edit_page_content_path(@page.id, page_content), class: "btn btn-small btn-primary" %>
|
9
9
|
</td>
|
10
10
|
<td><strong><%= page_content.label %></strong></td>
|
11
11
|
<td><%= page_content.content_block_type.demodulize %></td>
|
12
12
|
<td><%= page_content.updated_at.strftime('%b %e, %Y %H:%M:%S') %></td>
|
13
13
|
<td>
|
14
14
|
<div class="pull-right">
|
15
|
-
<%= link_to "preview", preview_page_content_path(@page.id, page_content), :
|
16
|
-
<%= link_to "<i class=\"icon-trash\"></i> delete".html_safe, page_content_path(@page.id, page_content), :
|
15
|
+
<%= link_to "preview", preview_page_content_path(@page.id, page_content), class: "btn btn-small", data: { previewtoggle: "modal" } %>
|
16
|
+
<%= link_to "<i class=\"icon-trash\"></i> delete".html_safe, page_content_path(@page.id, page_content), method: :delete, data: { confirm: "Do you really want to delete this content?" }, class: "btn btn-small btn-danger" %>
|
17
17
|
</div>
|
18
18
|
</td>
|
19
19
|
<% end %>
|
20
20
|
<% end %>
|
21
21
|
</table>
|
22
|
-
<div><%= link_to "Add to #{container.display_name}", new_page_content_path(@page.id, :
|
22
|
+
<div><%= link_to "Add to #{container.display_name}", new_page_content_path(@page.id, page_content: { container: container.name }), class: "btn btn-primary btn-small" %></div>
|
23
23
|
<% end %>
|
24
24
|
</div>
|
@@ -17,5 +17,6 @@
|
|
17
17
|
</dl>
|
18
18
|
</div>
|
19
19
|
|
20
|
-
<%= content_tag :p, link_to("
|
20
|
+
<%= content_tag :p, link_to("View Page", @page.path, class: 'btn btn-primary') if @page.persisted? && @page.published? %></p>
|
21
|
+
<%= content_tag :p, link_to("Delete Page", page_path(@page.id), method: :delete, data: { confirm: "Are you sure you want to delete this page?" }, class: 'btn btn-danger') if @page.persisted? %></p>
|
21
22
|
<% end %>
|
@@ -2,5 +2,5 @@
|
|
2
2
|
<dd>
|
3
3
|
<%= setting.value %>
|
4
4
|
<%= link_to "edit", [:edit, setting], :class => 'btn btn-mini' %>
|
5
|
-
<%= link_to "delete", setting, :
|
5
|
+
<%= link_to "delete", setting, class: 'btn btn-mini btn-danger', data: { confirm: "Are you sure?" }, method: :delete %>
|
6
6
|
</dd>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
<%= semantic_form_for @template do |f| %>
|
7
7
|
<%= f.inputs do %>
|
8
|
-
<%= f.input :content, :label => "Template Content", :
|
8
|
+
<%= f.input :content, :label => "Template Content", input_html: { id: "template_content-#{@template.id}" } %>
|
9
9
|
<div id="template_content_editor-<%= @template.id %>" class="template_content_editor"></div>
|
10
10
|
<% end %>
|
11
11
|
<%= f.actions do %>
|
@@ -32,5 +32,5 @@
|
|
32
32
|
</div>
|
33
33
|
<% end %>
|
34
34
|
|
35
|
-
<p><%= link_to "Delete #{@template.template_type.capitalize}", @template, :
|
35
|
+
<p><%= link_to "Delete #{@template.template_type.capitalize}", @template, method: :delete, data: { confirm: "Are you sure you want to delete this #{@template.template_type}?" }, class: 'btn btn-danger' %></p>
|
36
36
|
<% end %>
|
@@ -10,7 +10,7 @@ Dragonfly.app.configure do
|
|
10
10
|
convert_command = `which convert`.strip.presence || "/usr/local/bin/convert"
|
11
11
|
identify_command = `which identify`.strip.presence || "/usr/local/bin/identify"
|
12
12
|
|
13
|
-
url_format '/uploads/assets/:job/:
|
13
|
+
url_format '/uploads/assets/:job/:name'
|
14
14
|
|
15
15
|
datastore Smithy::Asset.dragonfly_datastore
|
16
16
|
end
|
@@ -3,7 +3,8 @@ module Smithy
|
|
3
3
|
module Model
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
included do
|
6
|
-
has_many :page_contents, :as => :content_block
|
6
|
+
has_many :page_contents, :as => :content_block, class_name: '::Smithy::PageContent'
|
7
|
+
has_many :pages, through: :page_contents, class_name: '::Smithy::Page'
|
7
8
|
Smithy::ContentBlocks::Registry.register self
|
8
9
|
end
|
9
10
|
|
@@ -16,6 +16,10 @@ module Smithy
|
|
16
16
|
self._source.children.map(&:to_liquid)
|
17
17
|
end
|
18
18
|
|
19
|
+
def nav_children
|
20
|
+
self._source.children.included_in_navigation.map(&:to_liquid)
|
21
|
+
end
|
22
|
+
|
19
23
|
def container
|
20
24
|
self.rendered_containers
|
21
25
|
end
|
@@ -28,6 +32,20 @@ module Smithy
|
|
28
32
|
self._source.keywords
|
29
33
|
end
|
30
34
|
|
35
|
+
def next
|
36
|
+
sibling = if self._source.leaf?
|
37
|
+
self._source.right_sibling
|
38
|
+
elsif self._source.children.size
|
39
|
+
self._source.children.first
|
40
|
+
end
|
41
|
+
sibling ||= self._source.parent.right_sibling
|
42
|
+
sibling.to_liquid
|
43
|
+
end
|
44
|
+
|
45
|
+
def next_sibling
|
46
|
+
self._source.right_sibling.to_liquid
|
47
|
+
end
|
48
|
+
|
31
49
|
def parent
|
32
50
|
self._source.parent.to_liquid
|
33
51
|
end
|
@@ -36,6 +54,20 @@ module Smithy
|
|
36
54
|
self._source.url
|
37
55
|
end
|
38
56
|
|
57
|
+
def previous
|
58
|
+
sibling = if self._source.left_sibling && self._source.left_sibling.leaf?
|
59
|
+
self._source.left_sibling
|
60
|
+
elsif self._source.left_sibling && self._source.left_sibling.children.size
|
61
|
+
self._source.left_sibling.children.last
|
62
|
+
end
|
63
|
+
sibling ||= self._source.parent
|
64
|
+
sibling.to_liquid
|
65
|
+
end
|
66
|
+
|
67
|
+
def previous_sibling
|
68
|
+
sibling = self._source.left_sibling.to_liquid
|
69
|
+
end
|
70
|
+
|
39
71
|
def published?
|
40
72
|
self._source.published?
|
41
73
|
end
|
@@ -3,8 +3,8 @@ module Smithy
|
|
3
3
|
module Filters
|
4
4
|
module AssetTag
|
5
5
|
def image_tag(input, *args)
|
6
|
-
image_options =
|
7
|
-
|
6
|
+
image_options = args_to_options(args)
|
7
|
+
controller.view_context.send(:image_tag, input, image_options)
|
8
8
|
end
|
9
9
|
|
10
10
|
protected
|
@@ -20,6 +20,14 @@ module Smithy
|
|
20
20
|
options
|
21
21
|
end
|
22
22
|
|
23
|
+
def context
|
24
|
+
context = self.instance_variable_get(:@context)
|
25
|
+
end
|
26
|
+
|
27
|
+
def controller
|
28
|
+
context.registers[:controller]
|
29
|
+
end
|
30
|
+
|
23
31
|
# Write options (Hash) into a string according to the following pattern:
|
24
32
|
# <key1>="<value1>", <key2>="<value2", ...etc
|
25
33
|
def inline_options(options = {})
|
@@ -4,17 +4,21 @@ module Smithy
|
|
4
4
|
class Nav < ::Liquid::Tag
|
5
5
|
Syntax = /(#{::Liquid::Expression}+)?/
|
6
6
|
|
7
|
-
# {% nav
|
7
|
+
# {% nav %} is equivalent to
|
8
|
+
# {% nav site, depth: 1, id: 'nav', class: '', wrapper: true, active_class: 'on', include_root: 'true'}
|
9
|
+
# {% nav site|site-section|page|section %}
|
8
10
|
def initialize(tag_name, markup, tokens)
|
9
|
-
@options = { :id => 'nav', :depth => 1, :class => '', :active_class => 'on' }
|
11
|
+
@options = { :id => 'nav', :depth => 1, :class => '', :active_class => 'on', :include_root => false }
|
10
12
|
if markup =~ Syntax
|
11
13
|
@source = ($1 || 'site').gsub(/"|'/, '')
|
12
14
|
markup.scan(::Liquid::TagAttributes) do |key, value|
|
13
15
|
@options[key.to_sym] = value.gsub(/"|'/, '')
|
14
16
|
end
|
17
|
+
@options[:active_nested_class] = 'in'
|
15
18
|
@options[:depth] = @options[:depth].to_i
|
16
19
|
@options[:depth] = 100 if @options[:depth] == 0
|
17
|
-
@options[:wrapper] == "false" ? false : true
|
20
|
+
@options[:wrapper] = @options[:wrapper] == "false" ? false : true
|
21
|
+
@options[:include_root] = @options[:include_root] == "true" ? true : false
|
18
22
|
else
|
19
23
|
raise ::Liquid::SyntaxError.new("Syntax Error in 'nav' - Valid syntax: nav <site|page|section> <options>")
|
20
24
|
end
|
@@ -29,7 +33,8 @@ module Smithy
|
|
29
33
|
@site = context.registers[:site]
|
30
34
|
@page = context.registers[:page]
|
31
35
|
@controller = context.registers[:controller]
|
32
|
-
|
36
|
+
list_items = render_list_items(root_node)
|
37
|
+
@options[:wrapper] ? render_wrapper(list_items, @options[:id]) : list_items
|
33
38
|
end
|
34
39
|
|
35
40
|
def render_children(parent, depth)
|
@@ -43,12 +48,15 @@ module Smithy
|
|
43
48
|
href = item.url
|
44
49
|
label = item.title
|
45
50
|
css_class = " class=\"#{@options[:active_class]}\"" if (@page && @page.id == item.id) || (@controller && [item.path, item.external_link].include?(@controller.request.path))
|
51
|
+
css_class ||= " class=\"#{@options[:active_nested_class]}\"" if @page && @page.ancestors.include?(item)
|
46
52
|
%Q{#{" " * depth}<li id="#{item_id}"#{css_class}><a href="#{href}" id="#{item_id}-link">#{label}</a>#{render_children(item, depth.succ)}</li>}
|
47
53
|
end
|
48
54
|
|
49
|
-
def render_list_items(parent, depth)
|
50
|
-
return
|
51
|
-
|
55
|
+
def render_list_items(parent, depth=1)
|
56
|
+
return unless write_child_list_items?(parent, depth)
|
57
|
+
items = []
|
58
|
+
items << render_list_item(parent, depth) if depth == 1 && @options[:include_root]
|
59
|
+
parent.children.included_in_navigation.inject(items) do |items, item|
|
52
60
|
items << render_list_item(item, depth)
|
53
61
|
end.join("\n")
|
54
62
|
end
|
@@ -60,7 +68,7 @@ module Smithy
|
|
60
68
|
|
61
69
|
def root_node
|
62
70
|
case @source
|
63
|
-
when 'site'
|
71
|
+
when 'site', 'site-section'
|
64
72
|
Smithy::Page.root
|
65
73
|
when 'page'
|
66
74
|
@page
|
@@ -69,6 +77,13 @@ module Smithy
|
|
69
77
|
end
|
70
78
|
end
|
71
79
|
|
80
|
+
private
|
81
|
+
def write_child_list_items?(parent, depth)
|
82
|
+
return false unless parent.present? && !parent.leaf?
|
83
|
+
return true if @source == 'site-section' && @page.self_and_ancestors.include?(parent)
|
84
|
+
depth > @options[:depth] ? false : true
|
85
|
+
end
|
86
|
+
|
72
87
|
end
|
73
88
|
::Liquid::Template.register_tag('nav', Nav)
|
74
89
|
end
|
data/lib/smithy/version.rb
CHANGED