Skip to content

Commit fc23afd

Browse files
author
Alex Tharp
authored
Merge pull request #62 from cortex-cms/topic/COR-811-FieldType-Service-Layer
COR-811 + COR-812: Dynamic Transaction Layer + Domain Simplification
2 parents 27a67ce + adfc22b commit fc23afd

19 files changed

+88
-24
lines changed

app/assets/stylesheets/cortex-plugins-core/application.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
@import 'variables/colors';
33
@import 'variables/typography';
44

5+
@import 'components/tags-input';
56
@import 'components/thumbnail-placeholder';
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.bootstrap-tagsinput {
2+
width: 100%;
3+
border-radius: 0 !important;
4+
border-top: none;
5+
border-right: none;
6+
border-left: none;
7+
border-bottom: 1px solid $color-grey-light;
8+
box-shadow: none;
9+
}
10+
.cortex-bootstrap .label {
11+
border-radius: 0.75em;
12+
font-weight: normal;
13+
}
14+
15+
.cortex-bootstrap .label-info {
16+
background-color: $color-grey;
17+
}
18+
19+
.bootstrap-tagsinput .tag {
20+
text-transform: uppercase;
21+
}
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
= render_label
22
= render_tooltip unless @options[:tooltip].nil?
33

4-
%p
5-
Please select 1-2 Categories.
6-
74
- @options[:metadata]["data"]["tree_array"].each do |node|
85
= render_field_id
96
= cell(Plugins::Core::CheckboxCell, nil, form: @options[:form], node: node, data: data).(:checkbox)

app/models/asset_field_type.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def attacher
8888
end
8989

9090
def host_alias
91-
metadata[:storage][:host_alias] unless metadata[:storage][:host_alias].empty?
91+
metadata&.[](:storage)&.[](:host_alias)
9292
end
9393

9494
def versions_data

app/models/author_field_type.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ def author_name_present
3030
end
3131

3232
def validate_presence?
33-
@validations.key? :presence
33+
validations.key? :presence
3434
end
3535
end

app/models/date_time_field_type.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ def timestamp_is_valid?
3535
end
3636

3737
def validate_presence?
38-
@validations.key? :presence
38+
validations.key? :presence
3939
end
4040
end

app/models/float_field_type.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class FloatFieldType < FieldType
22
attr_accessor :float
3-
3+
44
validates :float, presence: true, if: Proc.new { |float| validate_key(:presence) }
55
validates_numericality_of :float, unless: "float.nil?"
66
validate :less_than, if: Proc.new { |float| validate_key(:max) }
@@ -27,14 +27,14 @@ def mapping_field_name
2727
end
2828

2929
def validate_key(key)
30-
@validations.key? key
30+
validations.key? key
3131
end
3232

3333
def less_than
34-
errors.add(:float, "must be less_than #{@validations[:max]}") if :float <= @validations[:max]
34+
errors.add(:float, "must be less_than #{validations[:max]}") if :float <= validations[:max]
3535
end
3636

3737
def greater_than
38-
errors.add(:float, "must be greater_than #{@validations[:min]}") if :float >= @validations[:min]
38+
errors.add(:float, "must be greater_than #{validations[:min]}") if :float >= validations[:min]
3939
end
4040
end

app/models/integer_field_type.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ def mapping_field_name
2727
end
2828

2929
def validate_key
30-
@validations.key? key
30+
validations.key? key
3131
end
3232

3333
def less_than
34-
errors.add(:integer, "must be less_than #{@validations[:max]}") if :integer <= @validations[:max]
34+
errors.add(:integer, "must be less_than #{validations[:max]}") if :integer <= validations[:max]
3535
end
3636

3737
def greater_than
38-
errors.add(:integer, "must be greater_than #{@validations[:min]}") if :integer >= @validations[:min]
38+
errors.add(:integer, "must be greater_than #{validations[:min]}") if :integer >= validations[:min]
3939
end
4040
end

app/models/tag_field_type.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ def mapping_field_name
2525
end
2626

2727
def validate_presence?
28-
@validations.key? :presence
28+
validations.key? :presence
2929
end
3030
end

app/models/text_field_type.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ def text_unique
3939
end
4040

4141
def validate_uniqueness?
42-
@validations.key? :uniqueness
42+
validations.key? :uniqueness
4343
end
4444

4545
def validate_presence?
46-
@validations.key? :presence
46+
validations.key? :presence
4747
end
4848

4949
def validate_length?
50-
@validations.key? :length
50+
validations.key? :length
5151
end
5252
end

0 commit comments

Comments
 (0)