archangel 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.jshintrc +2 -0
- data/.travis.yml +2 -0
- data/Gemfile +0 -1
- data/README.md +0 -1
- data/app/assets/javascripts/archangel/input/datetimepicker.js +87 -0
- data/app/assets/javascripts/archangel/object/translate/datetimepicker.js.erb +41 -0
- data/app/models/archangel/entry.rb +27 -0
- data/app/models/archangel/page.rb +17 -0
- data/app/policies/archangel/application_policy.rb +7 -7
- data/app/policies/archangel/asset_policy.rb +1 -1
- data/app/policies/archangel/entry_policy.rb +1 -1
- data/app/policies/archangel/site_policy.rb +2 -2
- data/app/themes/default/assets/javascripts/default/backend.js +4 -4
- data/app/themes/default/assets/stylesheets/default/backend.css +3 -0
- data/app/themes/default/assets/stylesheets/default/backend/core.scss +1 -1
- data/app/themes/default/assets/stylesheets/default/common/_selectize.scss +126 -77
- data/app/views/archangel/backend/entries/index.html.erb +1 -1
- data/app/views/archangel/backend/pages/index.html.erb +1 -1
- data/archangel.gemspec +0 -1
- data/config/initializers/simple_form_bootstrap.rb +1 -2
- data/config/locales/en.yml +31 -17
- data/docs/Extension/Ideas.md +2 -0
- data/lib/archangel.rb +0 -1
- data/lib/archangel/liquid/tags/application_tag.rb +58 -0
- data/lib/archangel/liquid/tags/asset_tag.rb +3 -37
- data/lib/archangel/liquid/tags/collection_tag.rb +1 -12
- data/lib/archangel/liquid/tags/gist_tag.rb +3 -37
- data/lib/archangel/liquid/tags/vimeo_tag.rb +3 -24
- data/lib/archangel/liquid/tags/widget_tag.rb +1 -6
- data/lib/archangel/liquid/tags/youtube_tag.rb +3 -24
- data/lib/archangel/testing_support/factories/archangel_entries.rb +5 -1
- data/lib/archangel/testing_support/factories/archangel_sites.rb +2 -0
- data/lib/archangel/version.rb +1 -1
- data/spec/controllers/archangel/frontend/pages_controller_spec.rb +1 -0
- data/spec/features/auth/log_in_spec.rb +56 -26
- data/spec/features/frontend/drop_variables_spec.rb +18 -2
- data/spec/features/frontend/homepage_redirect_spec.rb +2 -2
- data/spec/helpers/archangel/flash_helper_spec.rb +7 -3
- data/spec/models/archangel/asset_spec.rb +7 -2
- data/spec/models/archangel/collection_spec.rb +0 -3
- data/spec/models/archangel/entry_spec.rb +40 -0
- data/spec/models/archangel/page_spec.rb +20 -3
- data/spec/models/archangel/user_spec.rb +0 -3
- data/spec/models/archangel/widget_spec.rb +0 -3
- data/vendor/assets/javascripts/daterangepicker/daterangepicker.js +1529 -0
- data/vendor/assets/stylesheets/daterangepicker/_daterangepicker.scss +407 -0
- metadata +6 -18
- data/app/assets/javascripts/archangel/input/datetime_picker.js +0 -46
- data/app/assets/javascripts/archangel/object/translate/datetime_picker.js.erb +0 -26
@@ -34,7 +34,7 @@
|
|
34
34
|
|
35
35
|
<tbody id="sortable">
|
36
36
|
<% @entries.each do |entry| %>
|
37
|
-
<tr data-id="<%= entry.id %>">
|
37
|
+
<tr class="<%= entry.available_status %>" data-id="<%= entry.id %>">
|
38
38
|
<td class="text-center"><%= fa_icon("sort", title: Archangel.t(:sort)) %></td>
|
39
39
|
<% fields.each do |field| %>
|
40
40
|
<td><%= entry.value[field] %></td>
|
data/archangel.gemspec
CHANGED
@@ -29,7 +29,6 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_dependency "acts_as_tree", "~> 2.7"
|
30
30
|
s.add_dependency "anyway_config", "~> 1.2"
|
31
31
|
s.add_dependency "bootstrap", "~> 4.1"
|
32
|
-
s.add_dependency "bootstrap3-datetimepicker-rails", "~> 4.17"
|
33
32
|
s.add_dependency "carrierwave", "~> 1.2"
|
34
33
|
s.add_dependency "cocoon", "~> 1.2"
|
35
34
|
s.add_dependency "date_validator", "~> 0.9"
|
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
SimpleForm.setup do |config|
|
4
4
|
config.error_notification_class = "alert alert-danger"
|
5
|
-
config.button_class = "btn btn-
|
6
|
-
config.boolean_label_class = nil
|
5
|
+
config.button_class = "btn btn-primary"
|
7
6
|
|
8
7
|
config.wrappers :vertical_form, tag: "div",
|
9
8
|
class: "form-group",
|
data/config/locales/en.yml
CHANGED
@@ -20,26 +20,40 @@ en:
|
|
20
20
|
content_type: Content Type
|
21
21
|
dashboard: Dashboard
|
22
22
|
datetimepicker:
|
23
|
-
|
24
|
-
|
23
|
+
apply: Apply
|
24
|
+
cancel: Cancel
|
25
|
+
custom_range: Custom
|
25
26
|
date_format: "%Y-%m-%d"
|
26
27
|
date_format_js: YYYY-MM-DD
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
28
|
+
datetime_format: "%Y-%m-%d %H:%M"
|
29
|
+
datetime_format_js: YYYY-MM-DD HH:MM
|
30
|
+
days:
|
31
|
+
sunday: Sun
|
32
|
+
monday: Mon
|
33
|
+
tuesday: Tue
|
34
|
+
wednesday: Wed
|
35
|
+
thursday: Thu
|
36
|
+
friday: Fri
|
37
|
+
saturday: Sat
|
38
|
+
from: From
|
39
|
+
months:
|
40
|
+
january: January
|
41
|
+
february: February
|
42
|
+
march: March
|
43
|
+
april: April
|
44
|
+
may: May
|
45
|
+
june: June
|
46
|
+
july: July
|
47
|
+
august: August
|
48
|
+
september: September
|
49
|
+
october: October
|
50
|
+
november: November
|
51
|
+
december: December
|
52
|
+
separator: " - "
|
40
53
|
time_format: "%H:%M"
|
41
|
-
time_format_js: HH:
|
42
|
-
|
54
|
+
time_format_js: HH:MM
|
55
|
+
to: To
|
56
|
+
week: W
|
43
57
|
destroy: Destroy
|
44
58
|
duplicate_slug: duplicate slug
|
45
59
|
duplicate_field_slug: duplicate slug
|
data/docs/Extension/Ideas.md
CHANGED
data/lib/archangel.rb
CHANGED
@@ -11,6 +11,64 @@ module Archangel
|
|
11
11
|
#
|
12
12
|
class ApplicationTag < ::Liquid::Tag
|
13
13
|
include ::ActionView::Helpers::TagHelper
|
14
|
+
|
15
|
+
##
|
16
|
+
# Regex for asset name
|
17
|
+
#
|
18
|
+
ASSET_SYNTAX = /
|
19
|
+
#{::Liquid::QuotedString}
|
20
|
+
|
|
21
|
+
(
|
22
|
+
[\w-]+\.[\w]+
|
23
|
+
|
|
24
|
+
#{::Liquid::QuotedString}
|
25
|
+
)
|
26
|
+
/ox
|
27
|
+
|
28
|
+
##
|
29
|
+
# Regex for tag syntax
|
30
|
+
#
|
31
|
+
ASSET_ATTRIBUTES_SYNTAX = /
|
32
|
+
(?<asset>#{ASSET_SYNTAX})
|
33
|
+
\s*
|
34
|
+
(?<attributes>.*)
|
35
|
+
\s*
|
36
|
+
/omx
|
37
|
+
|
38
|
+
##
|
39
|
+
# Regex for "key: value" attributes
|
40
|
+
#
|
41
|
+
# Example
|
42
|
+
# {% tag_name "[slug]" [foo: bar, bat: "baz"] %}
|
43
|
+
#
|
44
|
+
KEY_VALUE_ATTRIBUTES_SYNTAX = /
|
45
|
+
(?<key>\w+)
|
46
|
+
\s*
|
47
|
+
\:
|
48
|
+
\s*
|
49
|
+
(?<value>#{::Liquid::QuotedFragment})
|
50
|
+
/ox
|
51
|
+
|
52
|
+
##
|
53
|
+
# Slug and attributes syntax
|
54
|
+
#
|
55
|
+
# Example
|
56
|
+
# {% tag_name "[slug]" [attributes] %}
|
57
|
+
#
|
58
|
+
SLUG_ATTRIBUTES_SYNTAX = /
|
59
|
+
(?<slug>#{::Liquid::QuotedFragment}+)
|
60
|
+
\s*
|
61
|
+
(?<attributes>.*)
|
62
|
+
\s*
|
63
|
+
/omx
|
64
|
+
|
65
|
+
##
|
66
|
+
# Slug syntax
|
67
|
+
#
|
68
|
+
# Example
|
69
|
+
# {% tag_name "[slug]" %}
|
70
|
+
#
|
71
|
+
SLUG_SYNTAX = /(?<slug>#{::Liquid::QuotedFragment}+)\s*/o
|
14
72
|
end
|
15
73
|
end
|
16
74
|
end
|
@@ -17,40 +17,6 @@ module Archangel
|
|
17
17
|
class AssetTag < ApplicationTag
|
18
18
|
include ::ActionView::Helpers::UrlHelper
|
19
19
|
|
20
|
-
##
|
21
|
-
# Regex for tag key
|
22
|
-
#
|
23
|
-
KEY_SYNTAX = /
|
24
|
-
#{::Liquid::QuotedString}
|
25
|
-
|
|
26
|
-
(
|
27
|
-
[\w-]+\.[\w]+
|
28
|
-
|
|
29
|
-
#{::Liquid::QuotedString}
|
30
|
-
)
|
31
|
-
/ox
|
32
|
-
|
33
|
-
##
|
34
|
-
# Regex for tag syntax
|
35
|
-
#
|
36
|
-
SYNTAX = /
|
37
|
-
(?<key>#{KEY_SYNTAX})
|
38
|
-
\s*
|
39
|
-
(?<attributes>.*)
|
40
|
-
\s*
|
41
|
-
/omx
|
42
|
-
|
43
|
-
##
|
44
|
-
# Regex for attributes
|
45
|
-
#
|
46
|
-
SYNTAX_ATTRIBUTES = /
|
47
|
-
(?<key>\w+)
|
48
|
-
\s*
|
49
|
-
\:
|
50
|
-
\s*
|
51
|
-
(?<value>#{::Liquid::QuotedFragment})
|
52
|
-
/ox
|
53
|
-
|
54
20
|
##
|
55
21
|
# Asset for Liquid
|
56
22
|
#
|
@@ -61,13 +27,13 @@ module Archangel
|
|
61
27
|
def initialize(tag_name, markup, options)
|
62
28
|
super
|
63
29
|
|
64
|
-
match =
|
30
|
+
match = ASSET_ATTRIBUTES_SYNTAX.match(markup)
|
65
31
|
|
66
32
|
if match.blank?
|
67
33
|
raise ::Liquid::SyntaxError, Archangel.t("errors.syntax.asset")
|
68
34
|
end
|
69
35
|
|
70
|
-
@key = ::Liquid::Variable.new(match[:
|
36
|
+
@key = ::Liquid::Variable.new(match[:asset], options).name
|
71
37
|
@attributes = {}
|
72
38
|
|
73
39
|
build_attributes(match[:attributes])
|
@@ -95,7 +61,7 @@ module Archangel
|
|
95
61
|
attr_reader :attributes, :key, :size
|
96
62
|
|
97
63
|
def build_attributes(attrs)
|
98
|
-
attrs.scan(
|
64
|
+
attrs.scan(KEY_VALUE_ATTRIBUTES_SYNTAX) do |key, value|
|
99
65
|
@attributes[key.to_sym] = ::Liquid::Expression.parse(value)
|
100
66
|
end
|
101
67
|
|
@@ -32,17 +32,6 @@ module Archangel
|
|
32
32
|
\s*
|
33
33
|
/omx
|
34
34
|
|
35
|
-
##
|
36
|
-
# Regex for attributes
|
37
|
-
#
|
38
|
-
SYNTAX_ATTRIBUTES = /
|
39
|
-
(?<key>\w+)
|
40
|
-
\s*
|
41
|
-
\:
|
42
|
-
\s*
|
43
|
-
(?<value>#{::Liquid::QuotedFragment})
|
44
|
-
/ox
|
45
|
-
|
46
35
|
##
|
47
36
|
# Collection for Liquid
|
48
37
|
#
|
@@ -63,7 +52,7 @@ module Archangel
|
|
63
52
|
@value = ::Liquid::Variable.new(match[:value], options).name
|
64
53
|
@attributes = {}
|
65
54
|
|
66
|
-
match[:attributes].scan(
|
55
|
+
match[:attributes].scan(KEY_VALUE_ATTRIBUTES_SYNTAX) do |key, value|
|
67
56
|
@attributes[key.to_sym] = ::Liquid::Expression.parse(value)
|
68
57
|
end
|
69
58
|
end
|
@@ -13,40 +13,6 @@ module Archangel
|
|
13
13
|
class GistTag < ApplicationTag
|
14
14
|
include ::ActionView::Helpers::AssetTagHelper
|
15
15
|
|
16
|
-
##
|
17
|
-
# Regex for tag key
|
18
|
-
#
|
19
|
-
KEY_SYNTAX = /
|
20
|
-
#{::Liquid::QuotedString}
|
21
|
-
|
|
22
|
-
(
|
23
|
-
[\w-]+\.[\w]+
|
24
|
-
|
|
25
|
-
#{::Liquid::QuotedString}
|
26
|
-
)
|
27
|
-
/ox
|
28
|
-
|
29
|
-
##
|
30
|
-
# Regex for tag syntax
|
31
|
-
#
|
32
|
-
SYNTAX = /
|
33
|
-
(?<key>#{KEY_SYNTAX})
|
34
|
-
\s*
|
35
|
-
(?<attributes>.*)
|
36
|
-
\s*
|
37
|
-
/omx
|
38
|
-
|
39
|
-
##
|
40
|
-
# Regex for attributes
|
41
|
-
#
|
42
|
-
SYNTAX_ATTRIBUTES = /
|
43
|
-
(?<key>\w+)
|
44
|
-
\s*
|
45
|
-
\:
|
46
|
-
\s*
|
47
|
-
(?<value>#{::Liquid::QuotedFragment})
|
48
|
-
/ox
|
49
|
-
|
50
16
|
##
|
51
17
|
# Asset for Liquid
|
52
18
|
#
|
@@ -57,16 +23,16 @@ module Archangel
|
|
57
23
|
def initialize(tag_name, markup, options)
|
58
24
|
super
|
59
25
|
|
60
|
-
match =
|
26
|
+
match = ASSET_ATTRIBUTES_SYNTAX.match(markup)
|
61
27
|
|
62
28
|
if match.blank?
|
63
29
|
raise ::Liquid::SyntaxError, Archangel.t("errors.syntax.gist")
|
64
30
|
end
|
65
31
|
|
66
|
-
@key = ::Liquid::Variable.new(match[:
|
32
|
+
@key = ::Liquid::Variable.new(match[:asset], options).name
|
67
33
|
@attributes = {}
|
68
34
|
|
69
|
-
match[:attributes].scan(
|
35
|
+
match[:attributes].scan(KEY_VALUE_ATTRIBUTES_SYNTAX) do |key, value|
|
70
36
|
@attributes[key.to_sym] = ::Liquid::Expression.parse(value)
|
71
37
|
end
|
72
38
|
end
|
@@ -18,27 +18,6 @@ module Archangel
|
|
18
18
|
# {% vimeo "183344978" frameborder:4 %}
|
19
19
|
#
|
20
20
|
class VimeoTag < ApplicationTag
|
21
|
-
##
|
22
|
-
# Regex for tag syntax
|
23
|
-
#
|
24
|
-
SYNTAX = /
|
25
|
-
(?<key>#{::Liquid::QuotedFragment}+)
|
26
|
-
\s*
|
27
|
-
(?<attributes>.*)
|
28
|
-
\s*
|
29
|
-
/omx
|
30
|
-
|
31
|
-
##
|
32
|
-
# Regex for attributes
|
33
|
-
#
|
34
|
-
SYNTAX_ATTRIBUTES = /
|
35
|
-
(?<key>\w+)
|
36
|
-
\s*
|
37
|
-
\:
|
38
|
-
\s*
|
39
|
-
(?<value>#{::Liquid::QuotedFragment})
|
40
|
-
/ox
|
41
|
-
|
42
21
|
##
|
43
22
|
# Vimeo video embed for Liquid
|
44
23
|
#
|
@@ -49,16 +28,16 @@ module Archangel
|
|
49
28
|
def initialize(tag_name, markup, options)
|
50
29
|
super
|
51
30
|
|
52
|
-
match =
|
31
|
+
match = SLUG_ATTRIBUTES_SYNTAX.match(markup)
|
53
32
|
|
54
33
|
if match.blank?
|
55
34
|
raise ::Liquid::SyntaxError, Archangel.t("errors.syntax.vimeo")
|
56
35
|
end
|
57
36
|
|
58
|
-
@key = ::Liquid::Variable.new(match[:
|
37
|
+
@key = ::Liquid::Variable.new(match[:slug], options).name
|
59
38
|
@attributes = {}
|
60
39
|
|
61
|
-
match[:attributes].scan(
|
40
|
+
match[:attributes].scan(KEY_VALUE_ATTRIBUTES_SYNTAX) do |key, value|
|
62
41
|
@attributes[key.to_sym] = ::Liquid::Expression.parse(value)
|
63
42
|
end
|
64
43
|
end
|
@@ -12,11 +12,6 @@ module Archangel
|
|
12
12
|
# {% widget widget-name %}
|
13
13
|
#
|
14
14
|
class WidgetTag < ApplicationTag
|
15
|
-
##
|
16
|
-
# Regex for tag syntax
|
17
|
-
#
|
18
|
-
SYNTAX = /(?<slug>#{::Liquid::QuotedFragment}+)\s*/o
|
19
|
-
|
20
15
|
##
|
21
16
|
# Widget for Liquid
|
22
17
|
#
|
@@ -27,7 +22,7 @@ module Archangel
|
|
27
22
|
def initialize(tag_name, markup, options)
|
28
23
|
super
|
29
24
|
|
30
|
-
match =
|
25
|
+
match = SLUG_SYNTAX.match(markup)
|
31
26
|
|
32
27
|
if match.blank?
|
33
28
|
raise ::Liquid::SyntaxError, Archangel.t("errors.syntax.widget")
|
@@ -23,27 +23,6 @@ module Archangel
|
|
23
23
|
# {% youtube "-X2atEH7nCg" frameborder:4 %}
|
24
24
|
#
|
25
25
|
class YoutubeTag < ApplicationTag
|
26
|
-
##
|
27
|
-
# Regex for tag syntax
|
28
|
-
#
|
29
|
-
SYNTAX = /
|
30
|
-
(?<key>#{::Liquid::QuotedFragment}+)
|
31
|
-
\s*
|
32
|
-
(?<attributes>.*)
|
33
|
-
\s*
|
34
|
-
/omx
|
35
|
-
|
36
|
-
##
|
37
|
-
# Regex for attributes
|
38
|
-
#
|
39
|
-
SYNTAX_ATTRIBUTES = /
|
40
|
-
(?<key>\w+)
|
41
|
-
\s*
|
42
|
-
\:
|
43
|
-
\s*
|
44
|
-
(?<value>#{::Liquid::QuotedFragment})
|
45
|
-
/ox
|
46
|
-
|
47
26
|
##
|
48
27
|
# YouTube video embed for Liquid
|
49
28
|
#
|
@@ -54,16 +33,16 @@ module Archangel
|
|
54
33
|
def initialize(tag_name, markup, options)
|
55
34
|
super
|
56
35
|
|
57
|
-
match =
|
36
|
+
match = SLUG_ATTRIBUTES_SYNTAX.match(markup)
|
58
37
|
|
59
38
|
if match.blank?
|
60
39
|
raise ::Liquid::SyntaxError, Archangel.t("errors.syntax.youtube")
|
61
40
|
end
|
62
41
|
|
63
|
-
@key = ::Liquid::Variable.new(match[:
|
42
|
+
@key = ::Liquid::Variable.new(match[:slug], options).name
|
64
43
|
@attributes = {}
|
65
44
|
|
66
|
-
match[:attributes].scan(
|
45
|
+
match[:attributes].scan(KEY_VALUE_ATTRIBUTES_SYNTAX) do |key, value|
|
67
46
|
@attributes[key.to_sym] = ::Liquid::Expression.parse(value)
|
68
47
|
end
|
69
48
|
end
|