binda 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +72 -41
- data/app/assets/stylesheets/binda/components/popup_warning.scss +20 -0
- data/app/controllers/binda/field_groups_controller.rb +2 -2
- data/app/controllers/binda/structures_controller.rb +1 -1
- data/app/helpers/binda/components_helper.rb +1 -1
- data/app/helpers/binda/field_groups_helper.rb +4 -4
- data/app/models/binda/field_setting.rb +1 -1
- data/app/models/binda/selection.rb +1 -1
- data/app/models/concerns/binda/default_helpers.rb +6 -11
- data/app/models/concerns/binda/fieldable_association_helpers/fieldable_audio_helpers.rb +0 -4
- data/app/models/concerns/binda/fieldable_association_helpers/fieldable_image_helpers.rb +3 -6
- data/app/models/concerns/binda/fieldable_association_helpers/fieldable_selection_helpers.rb +3 -3
- data/app/models/concerns/binda/fieldable_association_helpers/fieldable_svg_helpers.rb +0 -4
- data/app/models/concerns/binda/fieldable_association_helpers/fieldable_video_helpers.rb +0 -4
- data/app/views/binda/field_groups/form_item/_form_item_editor_existing_item.html.erb +5 -2
- data/app/views/binda/fieldable/_form_body.html.erb +1 -2
- data/app/views/binda/fieldable/_form_item_audio.html.erb +2 -1
- data/app/views/binda/fieldable/_form_item_date.html.erb +1 -0
- data/app/views/binda/fieldable/_form_item_image.html.erb +2 -1
- data/app/views/binda/fieldable/_form_item_string.html.erb +2 -1
- data/app/views/binda/fieldable/_form_item_svg.html.erb +3 -3
- data/app/views/binda/fieldable/_form_item_text.html.erb +3 -2
- data/app/views/binda/fieldable/_form_item_video.html.erb +2 -1
- data/app/views/binda/fieldable/_form_section_repeater.html.erb +1 -1
- data/app/views/binda/fieldable/form_item_selections/_form_item_checkbox.html.erb +3 -1
- data/app/views/binda/fieldable/form_item_selections/_form_item_radio.html.erb +3 -1
- data/app/views/binda/fieldable/form_item_selections/_form_item_selection.html.erb +3 -1
- data/app/views/binda/structures/sort_index.html.erb +5 -0
- data/app/views/layouts/binda/_popup_warning.html.erb +4 -1
- data/app/views/layouts/binda/_sidebar.html.erb +7 -7
- data/app/views/layouts/binda/application.html.erb +1 -0
- data/config/initializers/simple_form__fileupload.rb +19 -14
- data/config/locales/en.yml +2 -1
- data/db/migrate/1_create_binda_tables.rb +1 -0
- data/lib/binda/factories.rb +3 -0
- data/lib/binda/version.rb +1 -1
- data/lib/generators/binda/install/templates/config/initializers/carrierwave.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cdf2fdd2f63fc54ab639dce6c7c29e45c7c65bf
|
4
|
+
data.tar.gz: 73eef58c3714cb6e4c9650e41526ef536602335f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3028b32b74dd17caf6c09047ad1c471fdbceb89f3e94f53c45ee1b6060563c71ff07eb3605631c467f6014f5cde1295496450627194b66ad04ae7b962297b36b
|
7
|
+
data.tar.gz: 51c1457dabf83268f75850c134962476c2e03bc345d9b9a5c056a056bf89e195391abc0dac834ca58ca6730302244bf7c0c8f39d34606685c9a1b40c42806c07
|
data/README.md
CHANGED
@@ -4,7 +4,6 @@ A modular CMS for Ruby on Rails 5.1.
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/binda.svg)](https://badge.fury.io/rb/binda)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/lacolonia/binda/badges/gpa.svg)](https://codeclimate.com/github/lacolonia/binda)
|
6
6
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/5dc62774a6b8b63aa72b/test_coverage)](https://codeclimate.com/github/lacolonia/binda/test_coverage)
|
7
|
-
[![Dependency Status](https://gemnasium.com/badges/github.com/lacolonia/binda.svg)](https://gemnasium.com/github.com/lacolonia/binda)
|
8
7
|
[![Inline docs](http://inch-ci.org/github/lacolonia/binda.svg?branch=master)](http://inch-ci.org/github/lacolonia/binda)
|
9
8
|
|
10
9
|
> This documentation has been written for the [Official Documentation](http://www.rubydoc.info/gems/binda), not the Github README.
|
@@ -16,7 +15,7 @@ A modular CMS for Ruby on Rails 5.1.
|
|
16
15
|
|
17
16
|
# Quick Start
|
18
17
|
|
19
|
-
**Binda** is a headless CMS with an intuitive out-of-the-box interface which makes very easy
|
18
|
+
**Binda** is a headless CMS with an intuitive out-of-the-box interface which makes very easy creating application infrastructures.
|
20
19
|
|
21
20
|
The core element is the _structure_ element which is the finger print of any _component_ instance. Every _structure_ can have one or more _field-groups_ which can be populated with several _field-settings_. _Field-groups_ and _field-settings_ represent _components_ features, such as galleries, textareas, dates, repeaters and so on.
|
22
21
|
|
@@ -60,7 +59,7 @@ bundle install
|
|
60
59
|
|
61
60
|
Before completing the installation you need to setup the database. If you are going to use Postgres set it up now.
|
62
61
|
|
63
|
-
To complete binda installation run the installer from terminal. Binda will take you through a
|
62
|
+
To complete binda installation run the installer from terminal. Binda will take you through a short configuration process where you will setup the first user and some basic details.
|
64
63
|
|
65
64
|
```bash
|
66
65
|
rails generate binda:install
|
@@ -98,6 +97,16 @@ This lets you create another temporary super admin user.
|
|
98
97
|
## Specific needs
|
99
98
|
In order to use Carrierwave to process images you need to run MiniMagik. Please refer to [Carrierwave documentation](https://github.com/carrierwaveuploader/carrierwave#using-minimagick) to find more information.
|
100
99
|
|
100
|
+
If you need absolute URLs for your images remember to set up your asset host in config/environments/production.rb
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
Rails.application.configure do
|
104
|
+
...
|
105
|
+
config.action_controller.asset_host = 'http://your.host.com'
|
106
|
+
...
|
107
|
+
end
|
108
|
+
```
|
109
|
+
|
101
110
|
If you are not going to use Rails default ORM please check [Carrierwave documentation](https://github.com/carrierwaveuploader/carrierwave#datamapper-mongoid-sequel) and [Devise documentation](https://github.com/plataformatec/devise#other-orms).
|
102
111
|
|
103
112
|
---
|
@@ -114,7 +123,7 @@ This two preferences can be changed later on inside _Dashboard_ panel visible in
|
|
114
123
|
|
115
124
|
You can customize the _Dashboard_ panel adding, removing and modifing fields as you prefer. As a matter of fact in _Structures_ you can find the one related to _Dashboard_ which you can edit as you like. The only thing you shouldn't do is to turn it into a component!
|
116
125
|
|
117
|
-
You can also create new boards if you need it
|
126
|
+
You can also create new boards if you need it, you just have to create a structure and set it to `board` via admin panel or assign `instance_type: 'board'` to _structure_ (`your_structure.update_attribute('instance_type', 'board')`).
|
118
127
|
|
119
128
|
By default after the installation a `Board` called `dashboard` will be populated with three fields: a `Radio` called `maintenance-mode`, a `String` called `website-name` and `Text` called `webiste-description`.
|
120
129
|
|
@@ -431,39 +440,38 @@ You can retrieve field content from a instance of `Binda::Component`, `Binda::Bo
|
|
431
440
|
|
432
441
|
| Helper |||
|
433
442
|
|---|---|---|
|
434
|
-
| `has_text`| Returns `true/false` | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_text) |
|
435
|
-
| `get_text`| Returns the text. Use [`simple_format`](https://apidock.com/rails/ActionView/Helpers/TextHelper/simple_format) to maintain HTML tags. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_text) |
|
436
|
-
| `has_string`| Returns `true/false`. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_string) |
|
437
|
-
| `get_string`| Returns the text. Use [`simple_format`](https://apidock.com/rails/ActionView/Helpers/TextHelper/simple_format) to maintain HTML tags. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_string) |
|
438
|
-
|`has_image`| Returns `true/false`.| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_image) |
|
439
|
-
|`get_image_url(size)`| Returns the url of the image. A thumbnail version (200x200) by specifying `thumb` size. If no size is provided the method will return the original image size. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_image_url) |
|
440
|
-
|`get_image_path(size)`| Returns the path of the image. A thumbnail version (200x200) by specifying `thumb` size. If no size is provided the method will return the original image size. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_image_path) |
|
441
|
-
|`get_image_size`| Returns the image size in MB. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_image_size) |
|
442
|
-
|`get_image_dimension`| Returns a hash { width: xxx, height: xxx } with image dimension. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_image_dimension) |
|
443
|
-
|`get_image_mime_type`| Returns the mime type of the image. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_image_mime_type) |
|
444
|
-
|`has_svg`| Returns `true/false`.| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_svg) |
|
445
|
-
|`get_svg_url`| Returns the url of the svg. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_svg_url) |
|
446
|
-
|`get_svg_path`| Returns the path of the svg. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_svg_path) |
|
447
|
-
|`get_svg_size`| Returns the svg size in MB. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_svg_size) |
|
448
|
-
|`get_svg_mime_type`| Returns the mime type of the svg. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_svg_mime_type) |
|
449
|
-
|
450
|
-
|`
|
451
|
-
|`
|
452
|
-
|`
|
453
|
-
|`
|
454
|
-
|`
|
455
|
-
|`
|
456
|
-
|`
|
457
|
-
|`
|
458
|
-
|`
|
459
|
-
|`
|
460
|
-
|`
|
461
|
-
|`
|
462
|
-
|`
|
463
|
-
|`
|
464
|
-
|`
|
465
|
-
|`
|
466
|
-
|`get_related_boards`| Retrieve related boards. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_related_boards) |
|
443
|
+
| `has_text`| Returns `true/false` | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableTextHelpers:has_text) |
|
444
|
+
| `get_text`| Returns the text. Use [`simple_format`](https://apidock.com/rails/ActionView/Helpers/TextHelper/simple_format) to maintain HTML tags. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableTextHelpers:get_text) |
|
445
|
+
| `has_string`| Returns `true/false`. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableStringHelpers:has_string) |
|
446
|
+
| `get_string`| Returns the text. Use [`simple_format`](https://apidock.com/rails/ActionView/Helpers/TextHelper/simple_format) to maintain HTML tags. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableStringHelpers:get_string) |
|
447
|
+
|`has_image`| Returns `true/false`.| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableImageHelpers:has_image) |
|
448
|
+
|`get_image_url(size)`| Returns the url of the image. A thumbnail version (200x200) by specifying `thumb` size. If no size is provided the method will return the original image size. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableImageHelpers:get_image_url) |
|
449
|
+
|`get_image_path(size)`| Returns the path of the image. A thumbnail version (200x200) by specifying `thumb` size. If no size is provided the method will return the original image size. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableImageHelpers:get_image_path) |
|
450
|
+
|`get_image_size`| Returns the image size in MB. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableImageHelpers:get_image_size) |
|
451
|
+
|`get_image_dimension`| Returns a hash { width: xxx, height: xxx } with image dimension. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableImageHelpers:get_image_dimension) |
|
452
|
+
|`get_image_mime_type`| Returns the mime type of the image. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableImageHelpers:get_image_mime_type) |
|
453
|
+
|`has_svg`| Returns `true/false`.| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableSvgHelpers:has_svg) |
|
454
|
+
|`get_svg_url`| Returns the url of the svg. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableSvgHelpers:get_svg_url) |
|
455
|
+
|`get_svg_path`| Returns the path of the svg. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableSvgHelpers:get_svg_path) |
|
456
|
+
|`get_svg_size`| Returns the svg size in MB. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableSvgHelpers:get_svg_size) |
|
457
|
+
|`get_svg_mime_type`| Returns the mime type of the svg. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableSvgHelpers:get_svg_mime_type) |
|
458
|
+
|`has_video`| Returns `true/false`.| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableAudioHelpers:has_video)|
|
459
|
+
|`get_video_url`| Returns the url of the video. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableAudioHelpers:get_video_url) |
|
460
|
+
|`get_video_path`| Returns the path of the video. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableAudioHelpers:get_video_path) |
|
461
|
+
|`has_audio`| Returns `true/false`.| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableAudioHelpers:has_audio) |
|
462
|
+
|`get_audio_url`| Returns the url of the audio. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableAudioHelpers:get_audio_url) |
|
463
|
+
|`get_audio_path`| Returns the path of the audio. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableAudioHelpers:get_audio_path) |
|
464
|
+
|`has_date`| Returns `true/false` | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableDateHelpers:has_date) |
|
465
|
+
|`get_date`| Returns the date in `datetime` format. Use [`strftime`](https://apidock.com/rails/ActiveSupport/TimeWithZone/strftime) to change date format. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableDateHelpers:get_date) |
|
466
|
+
|`has_repeaters`| Returns `true/false`| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableRepeaterHelpers:has_repeaters) |
|
467
|
+
|`get_repeaters`| Returns an array of repeaters. See next session for more details. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableRepeaterHelpers:get_repeaters) |
|
468
|
+
|`get_selection_choices`| Returns an hash with label and value of the selected choice. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableSelectionHelpers:get_selection_choices) |
|
469
|
+
|`get_radio_choice`| Returns an hash with label and value of the selected choice. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableSelectionHelpers:get_radio_choice) |
|
470
|
+
|`get_checkbox_choices`| Returns an array of label/value pairs of all the selected choices. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableSelectionHelpers:get_checkbox_choices) |
|
471
|
+
|`has_related_components`| Check if has related components. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableRelationHelpers:has_related_components) |
|
472
|
+
|`get_related_components`| Retrieve related components. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableRelationHelpers:has_related_components) |
|
473
|
+
|`has_related_boards`| Check if has related boards. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableRelationHelpers:has_related_boards) |
|
474
|
+
|`get_related_boards`| Retrieve related boards. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers/FieldableRelationHelpers:has_related_boards) |
|
467
475
|
|
468
476
|
If you need to get each dependent of all relations with a specified slug (or slugs) you can use `B.get_relation_dependents` helper. This is very useful to retrieve only the instances which have a owner (and therefore are 'dependents').
|
469
477
|
|
@@ -893,18 +901,41 @@ Some specs are run against the database. If you haven't installed Binda on the d
|
|
893
901
|
RAILS_ENV=test rails db:migrate
|
894
902
|
```
|
895
903
|
|
896
|
-
The above command might generate an error. This is probably because you have previously installed Binda and the generator finds migration both in `binda/db/migrate` and `binda/spec/dummy/db/migrate`. To solve the issue, remove the `spec/dummy/db/migrate` folder and run the previous command again.
|
904
|
+
The above command might generate an error. This is probably because you have previously installed Binda and the generator finds migration both in `binda/db/migrate` and `binda/spec/dummy/db/migrate`. To solve the issue, remove the `spec/dummy/db/migrate` folder and run the previous command again.
|
905
|
+
|
906
|
+
```bash
|
907
|
+
cd spec/dummy
|
908
|
+
rm -rf db/migrate
|
909
|
+
rails db:drop
|
910
|
+
rails db:create
|
911
|
+
RAILS_ENV=test rails db:migrate
|
912
|
+
cd ../..
|
913
|
+
```
|
914
|
+
|
915
|
+
Here the oneliner:
|
897
916
|
|
898
917
|
```bash
|
899
|
-
cd spec/dummy && rm -rf db/migrate && rails db:drop && rails db:create && RAILS_ENV=test rails db:migrate
|
918
|
+
cd spec/dummy && rm -rf db/migrate && rails db:drop && rails db:create && RAILS_ENV=test rails db:migrate && cd ../..
|
900
919
|
```
|
901
920
|
|
902
|
-
In case you
|
921
|
+
If Binda migration have been updated then your `schema.rb` is outdated and will generate false failing tests. In this case you need to run following command to refresh your database configuration:
|
903
922
|
|
904
923
|
```bash
|
905
|
-
cd spec/dummy
|
924
|
+
cd spec/dummy
|
925
|
+
rm -r db/schema.rb
|
926
|
+
rails db:drop
|
927
|
+
rails db:create
|
928
|
+
rails generate binda:install
|
929
|
+
rm -rf db/migrate
|
930
|
+
rm -rf config/initializers/devise_backup_*.rb
|
931
|
+
cd ../..
|
906
932
|
```
|
907
933
|
|
934
|
+
Here the oneliner:
|
935
|
+
|
936
|
+
```bash
|
937
|
+
cd spec/dummy && rm -r db/schema.rb && rails db:drop && rails db:create && rails generate binda:install && rm -rf db/migrate && rm -rf config/initializers/devise_backup_*.rb && cd ../..
|
938
|
+
```
|
908
939
|
|
909
940
|
If in the future you need to clean your dummy app code, simply run:
|
910
941
|
|
@@ -35,6 +35,11 @@
|
|
35
35
|
}
|
36
36
|
|
37
37
|
.popup-warning--loader {
|
38
|
+
transition: opacity 0.1s 0.1s linear;
|
39
|
+
&.popup-warning--loader--hidden {
|
40
|
+
opacity: 0;
|
41
|
+
}
|
42
|
+
opacity: 1;
|
38
43
|
margin-bottom: 16px;
|
39
44
|
span {
|
40
45
|
display: inline-block;
|
@@ -56,3 +61,18 @@
|
|
56
61
|
animation-delay: 540ms;
|
57
62
|
}
|
58
63
|
}
|
64
|
+
|
65
|
+
.popup-warning--success {
|
66
|
+
transition: opacity 0.1s 0.1s linear;
|
67
|
+
opacity: 1;
|
68
|
+
position: absolute;
|
69
|
+
left: 50%;
|
70
|
+
transform: translateX(-50%);
|
71
|
+
margin-bottom: 16px;
|
72
|
+
color: $color-success;
|
73
|
+
font-size: 30px;
|
74
|
+
|
75
|
+
&.popup-warning--success--hidden {
|
76
|
+
opacity: 0;
|
77
|
+
}
|
78
|
+
}
|
@@ -95,7 +95,7 @@ module Binda
|
|
95
95
|
def field_group_params
|
96
96
|
params.require(:field_group).permit(
|
97
97
|
:name, :slug, :description, :position, :layout, :structure_id, field_settings_attributes: [
|
98
|
-
:id, :field_group_id, :field_setting_id, :name, :slug, :description, :field_type, :position, :required, :default_text, :ancestry, :default_choice_id, :allow_null, accepted_structure_ids: [], choices: [], choices_attributes: [
|
98
|
+
:id, :field_group_id, :field_setting_id, :name, :slug, :description, :field_type, :position, :required, :read_only, :default_text, :ancestry, :default_choice_id, :allow_null, accepted_structure_ids: [], choices: [], choices_attributes: [
|
99
99
|
:id, :field_setting_id, :label, :value
|
100
100
|
]
|
101
101
|
]
|
@@ -105,7 +105,7 @@ module Binda
|
|
105
105
|
def new_params
|
106
106
|
params.require(:field_group).permit(
|
107
107
|
new_field_settings: [
|
108
|
-
:id, :field_group_id, :field_setting_id, :name, :slug, :description, :field_type, :position, :required, :ancestry, :default_choice_id, :allow_null, choices: []
|
108
|
+
:id, :field_group_id, :field_setting_id, :name, :slug, :description, :field_type, :position, :required, :read_only, :ancestry, :default_choice_id, :allow_null, choices: []
|
109
109
|
],
|
110
110
|
new_choices: [
|
111
111
|
:id, :field_setting_id, :label, :value
|
@@ -97,7 +97,7 @@ module Binda
|
|
97
97
|
|
98
98
|
# Sort field settings following the order with which are listed in the array provided as a argument.
|
99
99
|
#
|
100
|
-
# @param
|
100
|
+
# @param field_groups [Array] the list of ids of the field groups
|
101
101
|
def sort_field_group_by(field_groups)
|
102
102
|
field_groups.each_with_index do |id, i|
|
103
103
|
FieldGroup.find( id ).update_column('position', i+1)
|
@@ -66,7 +66,7 @@ module Binda
|
|
66
66
|
#
|
67
67
|
# Rails guide reference --> http://guides.rubyonrails.org/action_controller_overview.html#hash-and-array-parameters
|
68
68
|
#
|
69
|
-
# @param
|
69
|
+
# @param argument [string] This should be the database column on which sort will be based
|
70
70
|
# @return [string] The URL with the encoded parameters
|
71
71
|
#
|
72
72
|
def get_sort_link_by argument
|
@@ -10,18 +10,18 @@ module Binda
|
|
10
10
|
# Get all components related to a "relation" field setting
|
11
11
|
def get_relationable_components(field_setting)
|
12
12
|
if @instance.class.to_s == 'Binda::Component'
|
13
|
-
|
13
|
+
Component.where(structure_id: Structure.where(id: field_setting.accepted_structure_ids)).where.not(id: @instance.id)
|
14
14
|
elsif @instance.class.to_s == 'Binda::Board'
|
15
|
-
|
15
|
+
Component.where(structure_id: Structure.where(id: field_setting.accepted_structure_ids))
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
19
|
# Get all boards related to a "relation" field setting
|
20
20
|
def get_relationable_boards(field_setting)
|
21
21
|
if @instance.class.to_s == 'Binda::Component'
|
22
|
-
|
22
|
+
Board.where(structure_id: Structure.where(id: field_setting.accepted_structure_ids))
|
23
23
|
elsif @instance.class.to_s == 'Binda::Board'
|
24
|
-
|
24
|
+
Board.where(structure_id: Structure.where(id: field_setting.accepted_structure_ids)).where.not(id: @instance.id)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -81,12 +81,12 @@ module Binda
|
|
81
81
|
end
|
82
82
|
|
83
83
|
after_save do
|
84
|
+
self.class.reset_field_settings_array
|
84
85
|
add_choice_if_allow_null_is_false
|
85
86
|
create_field_instances
|
86
87
|
end
|
87
88
|
|
88
89
|
after_create do
|
89
|
-
self.class.reset_field_settings_array
|
90
90
|
convert_allow_null__nil_to_false
|
91
91
|
set_default_position
|
92
92
|
end
|
@@ -201,7 +201,7 @@ module Binda
|
|
201
201
|
# - depend on a field setting which requires to have at least a choice
|
202
202
|
# - have no choice selected
|
203
203
|
#
|
204
|
-
# @param
|
204
|
+
# @param field_setting [string] Add the slug of a field setting to filter the query
|
205
205
|
#
|
206
206
|
# @return [array] An array of Binda::Selection objects
|
207
207
|
def self.get_selections_which_must_have_a_choice_but_have_none(field_setting = nil)
|
@@ -29,8 +29,7 @@ module Binda
|
|
29
29
|
# # reduce N+1 query issue by including dependencies
|
30
30
|
# B.get_components('page').includes(:strings, :texts, repeaters: [:images, :selections])
|
31
31
|
#
|
32
|
-
# @param slug [string] The slug of the structure to which the components belong
|
33
|
-
# @param slug [array] The slugs of the structures to which the components belongs
|
32
|
+
# @param slug [string/array] The slug of the structure to which the components belong
|
34
33
|
#
|
35
34
|
# @return [ActiveRecord::Relation Object] if slug is nil or is an array
|
36
35
|
#
|
@@ -58,8 +57,7 @@ module Binda
|
|
58
57
|
# # reduce N+1 query issue by including dependencies
|
59
58
|
# B.get_boards('default-dashboard').includes(:strings, :texts, repeaters: [:images, :selections]).first
|
60
59
|
#
|
61
|
-
# @param slug [string] The slug of the structure on which the board is based
|
62
|
-
# @param slug [array] The slugs of the structures to which the board belongs
|
60
|
+
# @param slug [string/array] The slug of the structure on which the board is based
|
63
61
|
#
|
64
62
|
# @return [ActiveRecord::Relation Object] if slug is nil or is an array
|
65
63
|
#
|
@@ -86,8 +84,7 @@ module Binda
|
|
86
84
|
# B.get_categories(['page', 'post'])
|
87
85
|
# # returns all categories belonging to 'page' structure and the ones belonging to 'post' structure
|
88
86
|
#
|
89
|
-
# @param slug [string] The slug of the structure to which categories belong
|
90
|
-
# @param slug [array] The slugs of the structures to which categories belong
|
87
|
+
# @param slug [string/array] The slug of the structure to which categories belong
|
91
88
|
#
|
92
89
|
# @return [ActiveRecord::Relation Object]
|
93
90
|
#
|
@@ -111,8 +108,7 @@ module Binda
|
|
111
108
|
# B.get_field_settings('subtitle')
|
112
109
|
# # returns an ActiveRecord::Relation (a sort of Array) containing the 'subtitle' field setting
|
113
110
|
#
|
114
|
-
# @param slug [string] The slug of a specific field setting
|
115
|
-
# @param slug [array] The slugs of the selected field settings
|
111
|
+
# @param slug [string/array] The slug of a specific field setting
|
116
112
|
#
|
117
113
|
# @return [ActiveRecord::Relation]
|
118
114
|
#
|
@@ -126,8 +122,7 @@ module Binda
|
|
126
122
|
|
127
123
|
# Get each owner of all relations with the specified slug (or slugs)
|
128
124
|
#
|
129
|
-
# @param
|
130
|
-
# @param slug [array] The slugs of the field settings to which the relations belong
|
125
|
+
# @param field_slug [string/array] The slug of the field setting to which the relations belong
|
131
126
|
#
|
132
127
|
# @return [Array]
|
133
128
|
#
|
@@ -155,7 +150,7 @@ module Binda
|
|
155
150
|
# You can also ask for all instance type of dependent or specify 'components' or 'boards' using
|
156
151
|
# the second parameter.
|
157
152
|
#
|
158
|
-
# @param
|
153
|
+
# @param field_slug [string] The slug of the field setting to which the relations belong
|
159
154
|
#
|
160
155
|
# @return [Array]
|
161
156
|
#
|
@@ -17,8 +17,6 @@ module Binda
|
|
17
17
|
# default is Carrierwave default (usually the real size)
|
18
18
|
#
|
19
19
|
# @param field_slug [string] The slug of the field setting
|
20
|
-
# @param size [string] The size. It can be 'thumb' 200x200 cropped,
|
21
|
-
# 'medium' 700x700 max size, 'large' 1400x1400 max size, or blank
|
22
20
|
# @return [string] The url of the audio
|
23
21
|
def get_audio_url(field_slug)
|
24
22
|
get_audio_info( field_slug, 'url' )
|
@@ -28,8 +26,6 @@ module Binda
|
|
28
26
|
# default is Carrierwave default (usually the real size)
|
29
27
|
#
|
30
28
|
# @param field_slug [string] The slug of the field setting
|
31
|
-
# @param size [string] The size. It can be 'thumb' 200x200 cropped,
|
32
|
-
# 'medium' 700x700 max size, 'large' 1400x1400 max size, or blank
|
33
29
|
# @return [string] The url of the audio
|
34
30
|
def get_audio_path(field_slug)
|
35
31
|
get_audio_info( field_slug, 'path' )
|
@@ -18,8 +18,7 @@ module Binda
|
|
18
18
|
# default is Carrierwave default (usually the real size)
|
19
19
|
#
|
20
20
|
# @param field_slug [string] The slug of the field setting
|
21
|
-
# @param size [string] The size. It can be 'thumb' 200x200 cropped
|
22
|
-
# 'medium' 700x700 max size, 'large' 1400x1400 max size, or blank
|
21
|
+
# @param size [string] The size. It can be 'thumb' 200x200 cropped.
|
23
22
|
# @return [string] The url of the image
|
24
23
|
def get_image_url(field_slug, size = '')
|
25
24
|
get_image_info( field_slug, size, 'url' )
|
@@ -29,8 +28,7 @@ module Binda
|
|
29
28
|
# default is Carrierwave default (usually the real size)
|
30
29
|
#
|
31
30
|
# @param field_slug [string] The slug of the field setting
|
32
|
-
# @param size [string] The size. It can be 'thumb' 200x200 cropped
|
33
|
-
# 'medium' 700x700 max size, 'large' 1400x1400 max size, or blank
|
31
|
+
# @param size [string] The size. It can be 'thumb' 200x200 cropped.
|
34
32
|
# @return [string] The url of the image
|
35
33
|
def get_image_path(field_slug, size = '')
|
36
34
|
get_image_info( field_slug, size, 'path' )
|
@@ -39,8 +37,7 @@ module Binda
|
|
39
37
|
# Get the object related to that field setting
|
40
38
|
#
|
41
39
|
# @param field_slug [string] The slug of the field setting
|
42
|
-
# @param size [string] The size. It can be 'thumb' 200x200 cropped
|
43
|
-
# 'medium' 700x700 max size, 'large' 1400x1400 max size, or blank
|
40
|
+
# @param size [string] The size. It can be 'thumb' 200x200 cropped.
|
44
41
|
# @param info [string] String of the info to be retrieved
|
45
42
|
# @return [string] The info requested if present
|
46
43
|
# @return [boolean] Returns false if no info is found or if image isn't found
|
@@ -16,10 +16,10 @@ module Binda
|
|
16
16
|
return { label: obj.choices.first.label, value: obj.choices.first.value }
|
17
17
|
end
|
18
18
|
|
19
|
-
# Get the select
|
19
|
+
# Get the select choice
|
20
20
|
#
|
21
21
|
# @param field_slug [string] The slug of the field setting
|
22
|
-
# @return [hash] A hash of containing the label and value of the selected choice. `{ label: 'the label',
|
22
|
+
# @return [hash] A hash of containing the label and value of the selected choice. `{ label: 'the label', value: 'the value'}`
|
23
23
|
def get_selection_choice(field_slug)
|
24
24
|
field_setting = FieldSetting.find_by(slug:field_slug)
|
25
25
|
obj = self.selections.find{ |t| t.field_setting_id == field_setting.id }
|
@@ -31,7 +31,7 @@ module Binda
|
|
31
31
|
# Get the select choices
|
32
32
|
#
|
33
33
|
# @param field_slug [string] The slug of the field setting
|
34
|
-
# @return [array] An array of hashes of containing label and value of the selected choices. `{ label: 'the label',
|
34
|
+
# @return [array] An array of hashes of containing label and value of the selected choices. `{ label: 'the label', value: 'the value'}`
|
35
35
|
def get_selection_choices(field_slug)
|
36
36
|
field_setting = FieldSetting.find_by(slug:field_slug)
|
37
37
|
obj = self.selections.find{ |t| t.field_setting_id == field_setting.id }
|
@@ -17,8 +17,6 @@ module Binda
|
|
17
17
|
# default is Carrierwave default (usually the real size)
|
18
18
|
#
|
19
19
|
# @param field_slug [string] The slug of the field setting
|
20
|
-
# @param size [string] The size. It can be 'thumb' 200x200 cropped,
|
21
|
-
# 'medium' 700x700 max size, 'large' 1400x1400 max size, or blank
|
22
20
|
# @return [string] The url of the svg
|
23
21
|
def get_svg_url(field_slug)
|
24
22
|
get_svg_info( field_slug, 'url' )
|
@@ -28,8 +26,6 @@ module Binda
|
|
28
26
|
# default is Carrierwave default (usually the real size)
|
29
27
|
#
|
30
28
|
# @param field_slug [string] The slug of the field setting
|
31
|
-
# @param size [string] The size. It can be 'thumb' 200x200 cropped,
|
32
|
-
# 'medium' 700x700 max size, 'large' 1400x1400 max size, or blank
|
33
29
|
# @return [string] The url of the svg
|
34
30
|
def get_svg_path(field_slug)
|
35
31
|
get_svg_info( field_slug, 'path' )
|
@@ -18,8 +18,6 @@ module Binda
|
|
18
18
|
# default is Carrierwave default (usually the real size)
|
19
19
|
#
|
20
20
|
# @param field_slug [string] The slug of the field setting
|
21
|
-
# @param size [string] The size. It can be 'thumb' 200x200 cropped,
|
22
|
-
# 'medium' 700x700 max size, 'large' 1400x1400 max size, or blank
|
23
21
|
# @return [string] The url of the video
|
24
22
|
def get_video_url(field_slug)
|
25
23
|
get_video_info( field_slug, 'url' )
|
@@ -29,8 +27,6 @@ module Binda
|
|
29
27
|
# default is Carrierwave default (usually the real size)
|
30
28
|
#
|
31
29
|
# @param field_slug [string] The slug of the field setting
|
32
|
-
# @param size [string] The size. It can be 'thumb' 200x200 cropped,
|
33
|
-
# 'medium' 700x700 max size, 'large' 1400x1400 max size, or blank
|
34
30
|
# @return [string] The url of the video
|
35
31
|
def get_video_path(field_slug)
|
36
32
|
get_video_info( field_slug, 'path' )
|
@@ -1,13 +1,16 @@
|
|
1
1
|
<div class="form-item--half-size">
|
2
2
|
<%= ff.input :slug, as: :string, input_html: { class: "form-item--input" } %>
|
3
3
|
</div>
|
4
|
-
<div class="form-item--
|
4
|
+
<div class="form-item--half-size">
|
5
5
|
<% if ff.object.field_type.nil? %>
|
6
6
|
<%= ff.input :field_type, as: :select, collection: get_field_types, include_blank: false, prompt: t(:select_field_type), input_html: { class: 'form-item--select-input' } %>
|
7
7
|
<% else %>
|
8
8
|
<%= ff.input :field_type, as: :string, disabled: true, input_html: { class: "form-item--input" } %>
|
9
9
|
<% end %>
|
10
10
|
</div>
|
11
|
+
<div class="form-item--half-size">
|
12
|
+
<%= ff.input :read_only, as: :boolean, label: "<span class=\"standard-form--input-box\"></span> #{ t('binda.read_only')}".html_safe, wrapper_html: { class: 'standard-form--radio' } %>
|
13
|
+
</div>
|
11
14
|
<div class="form-item--full-size">
|
12
15
|
<%= ff.input :description, input_html: { class: "form-item--input tinymce" } %>
|
13
16
|
</div>
|
@@ -21,4 +24,4 @@
|
|
21
24
|
include_blank: false,
|
22
25
|
include_hidden: false %>
|
23
26
|
</div>
|
24
|
-
<% end %>
|
27
|
+
<% end %>
|
@@ -1,4 +1,3 @@
|
|
1
|
-
<%= render 'layouts/binda/popup_warning' %>
|
2
1
|
<%= simple_form_for [ @instance.structure, @instance ], html: { class: 'form-body', multipart: true } do |f| %>
|
3
2
|
<%= f.error_notification %>
|
4
3
|
<%= render 'layouts/binda/form_errors', f: f %>
|
@@ -44,4 +43,4 @@
|
|
44
43
|
<div class="standard-form--container standard-form--sidebar">
|
45
44
|
<%= render "binda/fieldable/form_sidebar", f: f %>
|
46
45
|
</div>
|
47
|
-
<% end %>
|
46
|
+
<% end %>
|
@@ -14,6 +14,7 @@
|
|
14
14
|
url: url_for([ff.object, action: :remove_audio]).html_safe,
|
15
15
|
object: ff.object,
|
16
16
|
wrapper: false,
|
17
|
+
disabled: field_setting.read_only?,
|
17
18
|
input_html: {
|
18
19
|
class: 'form-item--audio--uploader',
|
19
20
|
'data-url': url_for([@instance.structure, @instance, action: :upload]),
|
@@ -30,4 +31,4 @@
|
|
30
31
|
<div class="clearfix"></div>
|
31
32
|
|
32
33
|
</div>
|
33
|
-
</div>
|
34
|
+
</div>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
<div id="standard-form--date-<%= field_setting.id %>" class="standard-form--date form-item">
|
2
2
|
<%= ff.input :date,
|
3
3
|
as: :date,
|
4
|
+
disabled: field_setting.read_only?,
|
4
5
|
start_year: Date.today.year - 200,
|
5
6
|
end_year: Date.today.year + 200,
|
6
7
|
hint: field_setting.description.nil? ? false : field_setting.description.html_safe,
|
@@ -12,6 +12,7 @@
|
|
12
12
|
label: "<i class=\"fa fa-upload\" aria-hidden=\"true\"></i> #{t('binda.choose_file_button')}".html_safe,
|
13
13
|
hint: field_setting.description.nil? ? false : field_setting.description.html_safe,
|
14
14
|
url: url_for([ff.object, action: :remove_image]).html_safe,
|
15
|
+
disabled: field_setting.read_only?,
|
15
16
|
object: ff.object,
|
16
17
|
wrapper: false,
|
17
18
|
input_html: {
|
@@ -30,4 +31,4 @@
|
|
30
31
|
<%= ff.input :fieldable_type, as: :hidden %>
|
31
32
|
<div class="clearfix"></div>
|
32
33
|
</div>
|
33
|
-
</div>
|
34
|
+
</div>
|
@@ -3,6 +3,7 @@
|
|
3
3
|
<%= ff.input :content,
|
4
4
|
input_html: { value: ff.object.content },
|
5
5
|
as: :string,
|
6
|
+
disabled: field_setting.read_only?,
|
6
7
|
hint: field_setting.description.nil? ? false : field_setting.description.html_safe,
|
7
8
|
label: field_setting.name %>
|
8
9
|
|
@@ -11,4 +12,4 @@
|
|
11
12
|
<%= ff.input :fieldable_id, as: :hidden %>
|
12
13
|
<%= ff.input :fieldable_type, as: :hidden %>
|
13
14
|
|
14
|
-
</div>
|
15
|
+
</div>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div id="standard-form--
|
1
|
+
<div id="standard-form--svg-<%= field_setting.id %>" class="standard-form--svg form-item">
|
2
2
|
<div id="fileupload-<%= ff.object.id %>"
|
3
3
|
class="fileupload form-group"
|
4
4
|
data-message="<%= t('binda.upload_loading_message') %>"
|
@@ -6,13 +6,13 @@
|
|
6
6
|
<p class="control-label">
|
7
7
|
<%= field_setting.name %>
|
8
8
|
</p>
|
9
|
-
<% image = ff.object.image.thumb.url if ff.object.image.present? %>
|
10
9
|
<div class="fileupload--field">
|
11
10
|
<%= ff.input :svg,
|
12
11
|
label: "<i class=\"fa fa-upload\" aria-hidden=\"true\"></i> #{t('binda.choose_file_button')}".html_safe,
|
13
12
|
hint: field_setting.description.nil? ? false : field_setting.description.html_safe,
|
14
13
|
url: url_for([ff.object, action: :remove_svg]).html_safe,
|
15
14
|
object: ff.object,
|
15
|
+
disabled: field_setting.read_only?,
|
16
16
|
wrapper: false,
|
17
17
|
input_html: {
|
18
18
|
'data-url': url_for([
|
@@ -30,4 +30,4 @@
|
|
30
30
|
<%= ff.input :fieldable_type, as: :hidden %>
|
31
31
|
<div class="clearfix"></div>
|
32
32
|
</div>
|
33
|
-
</div>
|
33
|
+
</div>
|
@@ -1,8 +1,9 @@
|
|
1
1
|
<div id="standard-form--text-<%= field_setting.id %>" class="standard-form--text form-item">
|
2
2
|
|
3
3
|
<%= ff.input :content,
|
4
|
-
input_html: { value: ff.object.content, class: 'tinymce' },
|
4
|
+
input_html: { value: ff.object.content, class: ( field_setting.read_only? ? '' : 'tinymce' ) },
|
5
5
|
as: :text,
|
6
|
+
disabled: field_setting.read_only?,
|
6
7
|
hint: field_setting.description.nil? ? false : field_setting.description.html_safe,
|
7
8
|
label: field_setting.name %>
|
8
9
|
|
@@ -11,4 +12,4 @@
|
|
11
12
|
<%= ff.input :fieldable_id, as: :hidden %>
|
12
13
|
<%= ff.input :fieldable_type, as: :hidden %>
|
13
14
|
|
14
|
-
</div>
|
15
|
+
</div>
|
@@ -12,6 +12,7 @@
|
|
12
12
|
hint: field_setting.description.nil? ? false : field_setting.description.html_safe,
|
13
13
|
url: url_for([ff.object, action: :remove_video]).html_safe,
|
14
14
|
object: ff.object,
|
15
|
+
disabled: field_setting.read_only?,
|
15
16
|
wrapper: false,
|
16
17
|
input_html: {
|
17
18
|
class: 'form-item--video--uploader',
|
@@ -31,4 +32,4 @@
|
|
31
32
|
<div class="clearfix"></div>
|
32
33
|
|
33
34
|
</div>
|
34
|
-
</div>
|
35
|
+
</div>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% if %w(text string date image video audio relation).include? repeater_setting_child.field_type %>
|
1
|
+
<% if %w(text string date image video audio relation svg).include? repeater_setting_child.field_type %>
|
2
2
|
<% current = @instance.repeaters.select{|r| r.id == f.object.id}.first.find_or_create_a_field_by( repeater_setting_child.id, repeater_setting_child.field_type ) %>
|
3
3
|
<%= f.simple_fields_for "#{repeater_setting_child.field_type}s_attributes[]", current do |ff| %>
|
4
4
|
<%= render "binda/fieldable/form_item_#{repeater_setting_child.field_type}", f: f, ff: ff, field_setting: repeater_setting_child %>
|
@@ -5,6 +5,7 @@
|
|
5
5
|
label: field_setting.name.capitalize,
|
6
6
|
hint: prepare_description_for_selections_form_hint(field_setting),
|
7
7
|
as: :check_boxes,
|
8
|
+
disabled: field_setting.read_only?,
|
8
9
|
collection: field_setting.choices.order(:label),
|
9
10
|
label_method: -> (field_setting) {
|
10
11
|
"<span class=\"standard-form--input-box\"></span>#{field_setting[:label]}".html_safe
|
@@ -18,6 +19,7 @@
|
|
18
19
|
label: field_setting.name.capitalize,
|
19
20
|
hint: prepare_description_for_selections_form_hint(field_setting),
|
20
21
|
as: :check_boxes,
|
22
|
+
disabled: field_setting.read_only?,
|
21
23
|
collection: field_setting.choices.order(:label),
|
22
24
|
label_method: -> (field_setting){
|
23
25
|
"<span class=\"standard-form--input-box\"></span>#{field_setting[:label]}".html_safe
|
@@ -31,4 +33,4 @@
|
|
31
33
|
<%= ff.input :id, as: :hidden, input_html: { value: ff.object.id } %>
|
32
34
|
<%= ff.input :fieldable_id, as: :hidden %>
|
33
35
|
<%= ff.input :fieldable_type, as: :hidden %>
|
34
|
-
<% end %>
|
36
|
+
<% end %>
|
@@ -5,6 +5,7 @@
|
|
5
5
|
label: field_setting.name.capitalize,
|
6
6
|
hint: prepare_description_for_selections_form_hint(field_setting),
|
7
7
|
as: :radio_buttons,
|
8
|
+
disabled: field_setting.read_only?,
|
8
9
|
collection: field_setting.choices.order(:label),
|
9
10
|
label_method: -> (x){ "<span class=\"standard-form--input-box\"></span>#{x[:label]}".html_safe },
|
10
11
|
value_method: :id,
|
@@ -15,6 +16,7 @@
|
|
15
16
|
label: field_setting.name.capitalize,
|
16
17
|
hint: prepare_description_for_selections_form_hint(field_setting),
|
17
18
|
as: :radio_buttons,
|
19
|
+
disabled: field_setting.read_only?,
|
18
20
|
collection: field_setting.choices.order(:label),
|
19
21
|
label_method: -> (x){ "<span class=\"standard-form--input-box\"></span>#{x[:label]}".html_safe },
|
20
22
|
value_method: :id,
|
@@ -25,4 +27,4 @@
|
|
25
27
|
<%= ff.input :id, as: :hidden, input_html: { value: ff.object.id } %>
|
26
28
|
<%= ff.input :fieldable_id, as: :hidden %>
|
27
29
|
<%= ff.input :fieldable_type, as: :hidden %>
|
28
|
-
<% end %>
|
30
|
+
<% end %>
|
@@ -5,6 +5,7 @@
|
|
5
5
|
label: field_setting.name.capitalize,
|
6
6
|
hint: prepare_description_for_selections_form_hint(field_setting),
|
7
7
|
as: :select,
|
8
|
+
disabled: field_setting.read_only?,
|
8
9
|
collection: field_setting.choices.order(:label),
|
9
10
|
label_method: :label,
|
10
11
|
value_method: :id,
|
@@ -16,6 +17,7 @@
|
|
16
17
|
label: field_setting.name.capitalize,
|
17
18
|
hint: prepare_description_for_selections_form_hint(field_setting),
|
18
19
|
as: :select,
|
20
|
+
disabled: field_setting.read_only?,
|
19
21
|
collection: field_setting.choices.order(:label),
|
20
22
|
label_method: :label,
|
21
23
|
value_method: :id,
|
@@ -27,4 +29,4 @@
|
|
27
29
|
<%= ff.input :id, as: :hidden, input_html: { value: ff.object.id } %>
|
28
30
|
<%= ff.input :fieldable_id, as: :hidden %>
|
29
31
|
<%= ff.input :fieldable_type, as: :hidden %>
|
30
|
-
<% end %>
|
32
|
+
<% end %>
|
@@ -1,4 +1,7 @@
|
|
1
1
|
<div class="popup-warning popup-warning--hidden">
|
2
|
+
<div class="popup-warning--success popup-warning--success--hidden">
|
3
|
+
<i class="fas fa-check-circle"></i>
|
4
|
+
</div>
|
2
5
|
<div class="popup-warning--loader">
|
3
6
|
<span></span>
|
4
7
|
<span></span>
|
@@ -6,4 +9,4 @@
|
|
6
9
|
<span></span>
|
7
10
|
</div>
|
8
11
|
<p class="popup-warning--message"></p>
|
9
|
-
</div>
|
12
|
+
</div>
|
@@ -6,9 +6,9 @@
|
|
6
6
|
%>
|
7
7
|
|
8
8
|
<% unless is_devise_controller %>
|
9
|
-
<div id="main-sidebar">
|
9
|
+
<div data-hook="main-sidebar" id="main-sidebar">
|
10
10
|
<ul class="main-sidebar--nav">
|
11
|
-
<li class= "main-sidebar--brand">
|
11
|
+
<li data-hook="main-sidebar-head" class= "main-sidebar--brand">
|
12
12
|
<a href="/" target="_blank">
|
13
13
|
<p class="main-sidebar--website-name"><%= get_website_name %></p>
|
14
14
|
<p class= "main-sidebar--view-website">
|
@@ -41,25 +41,25 @@
|
|
41
41
|
<% end %>
|
42
42
|
<% end %>
|
43
43
|
<% if current_user.is_superadmin %>
|
44
|
-
<li>
|
44
|
+
<li data-hook="main-sidebar-structures">
|
45
45
|
<a href="<%= structures_path %>">
|
46
46
|
<i class="fas fa-sitemap"></i> Structures
|
47
47
|
</a>
|
48
48
|
</li>
|
49
49
|
<% end %>
|
50
|
-
<li>
|
50
|
+
<li data-hook="main-sidebar-manage-users">
|
51
51
|
<a href="<%= manage_users_path %>">
|
52
52
|
<i class="fas fa-user"></i> Users
|
53
53
|
</a>
|
54
54
|
</li>
|
55
|
-
<li>
|
55
|
+
<li data-hook="main-sidebar-log-out">
|
56
56
|
<a href="<%= destroy_user_session_path %>" data-method="delete">
|
57
57
|
<i class="fas fa-sign-out-alt"></i> Log out
|
58
58
|
</a>
|
59
59
|
</li>
|
60
60
|
</ul>
|
61
|
-
<div class="main-sidebar--footer">
|
61
|
+
<div data-hook="main-sidebar-foot" class="main-sidebar--footer">
|
62
62
|
<small><a href="https://github.com/lacolonia/binda" target="_blank"><%= t('binda.login_credit', { arg1: Binda::VERSION.dup}) %></a></small>
|
63
63
|
</div>
|
64
64
|
</div>
|
65
|
-
<% end %>
|
65
|
+
<% end %>
|
@@ -55,19 +55,24 @@ module SimpleForm
|
|
55
55
|
@delete_button ||= begin
|
56
56
|
obj = options[:object]
|
57
57
|
url = options[:url]
|
58
|
-
html = '
|
59
|
-
|
60
|
-
html
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
html <<
|
68
|
-
html <<
|
69
|
-
|
70
|
-
|
58
|
+
html = ''
|
59
|
+
unless obj.field_setting.read_only?
|
60
|
+
html = '<a class="b-btn b-btn-outline-danger fileupload--remove-image-btn'
|
61
|
+
html << ' fileupload--remove-image-btn--hidden' unless obj.image.present? || obj.video.present? || obj.audio.present? || obj.svg.present?
|
62
|
+
html << '" href="'
|
63
|
+
html << url
|
64
|
+
html << '" data-method="delete" data-remote="true" data-confirm="'
|
65
|
+
html << t('binda.confirm_delete')
|
66
|
+
html << '" data-id="'
|
67
|
+
html << obj.id.to_s
|
68
|
+
html << '">'
|
69
|
+
html << '<i class="fa fa-trash-alt" aria-hidden="true"></i>'
|
70
|
+
html << t('binda.delete')
|
71
|
+
html << '</a>'
|
72
|
+
html << '<div class="clearfix"></div>'
|
73
|
+
end
|
74
|
+
|
75
|
+
html
|
71
76
|
end
|
72
77
|
end
|
73
78
|
|
@@ -132,4 +137,4 @@ end
|
|
132
137
|
|
133
138
|
SimpleForm::Inputs::Base.send(:include, SimpleForm::Components::Previews)
|
134
139
|
SimpleForm::Inputs::Base.send(:include, SimpleForm::Components::DeleteButtons)
|
135
|
-
SimpleForm::Inputs::Base.send(:include, SimpleForm::Components::Details)
|
140
|
+
SimpleForm::Inputs::Base.send(:include, SimpleForm::Components::Details)
|
data/config/locales/en.yml
CHANGED
@@ -117,6 +117,7 @@ en:
|
|
117
117
|
edit_category: Edit %{arg1} category
|
118
118
|
has_categories: Enable categories
|
119
119
|
has_preview: Enable preview
|
120
|
+
read_only: Read Only
|
120
121
|
has_categories_hint: Enable a taxonomy specific to this structure
|
121
122
|
preview_path_warning: Make preview available. Once enabled, remember to create a route in you application for
|
122
123
|
relation_warning: This relation isn't set properly. Ensure the setup of this relation refers to at least one structure.
|
@@ -158,4 +159,4 @@ en:
|
|
158
159
|
no_available_choice_user_hint: Please contact the administrator
|
159
160
|
no_available_choice_superadmin_hint: Please ensure you setup at least two possible choices when editing the
|
160
161
|
settings: Settings
|
161
|
-
duplicate_validation: There is already one %{arg1} associated to component '%{arg2}' and field setting '%{arg3}'
|
162
|
+
duplicate_validation: There is already one %{arg1} associated to component '%{arg2}' and field setting '%{arg3}'
|
data/lib/binda/version.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
CarrierWave.configure do |config|
|
2
2
|
config.storage = :file
|
3
|
+
config.asset_host = ActionController::Base.asset_host
|
3
4
|
|
4
5
|
|
5
6
|
# # If you prefer to use Google uncomment and udpate the following lines
|
@@ -38,4 +39,4 @@ CarrierWave.configure do |config|
|
|
38
39
|
|
39
40
|
|
40
41
|
config.enable_processing = !Rails.env.test?
|
41
|
-
end
|
42
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: binda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Barbieri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -886,6 +886,7 @@ files:
|
|
886
886
|
- db/migrate/1_create_binda_tables.rb
|
887
887
|
- lib/binda.rb
|
888
888
|
- lib/binda/engine.rb
|
889
|
+
- lib/binda/factories.rb
|
889
890
|
- lib/binda/version.rb
|
890
891
|
- lib/generators/binda/install/USAGE
|
891
892
|
- lib/generators/binda/install/install_generator.rb
|