Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #166 from a-barbieri/master
Browse files Browse the repository at this point in the history
New features: sortable for field groups and field settings + field setting list for each group
  • Loading branch information
a-barbieri authored Feb 15, 2018
2 parents 725aa1d + 7fed708 commit 3995d90
Show file tree
Hide file tree
Showing 112 changed files with 19,482 additions and 1,731 deletions.
29 changes: 28 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,31 @@ gemspec
# To use a debugger
# gem 'byebug', group: [:development, :test]

gem 'simplecov', :require => false, :group => :test
# group :development do
# gem "listen", "~> 3.1"
# gem "autoprefixer-rails", "~> 7.1", "< 8"
# end

# group :development, :test do
# gem "pg", ">= 0.21", "< 1.0"
# gem "pry-rails", "~> 0.3.5"
# gem "bullet", ">= 5.6", "< 6"
# gem "rspec-rails", ">= 3.5", "< 3.8"
# gem "generator_spec", "~> 0.9.4"
# end
gem 'simplecov'

# group :test do
# gem 'simplecov'
# gem "capybara", ">= 2.14", "< 3"
# gem "selenium-webdriver", "~> 3.5", "< 4"
# gem "factory_bot_rails", "~> 4.8"
# gem "database_cleaner", ">= 1.6", "< 2"
# gem "yard", "> 0.9.11", "< 1.0"
# gem "yard-activesupport-concern", "~> 0.0.1", "< 0.1"
# gem "redcarpet", "~> 3.4"
# gem "github-markup", ">= 1.6", "< 2"
# gem "travis", "~> 1.8"
# gem "rubocop", "~> 0.52.1"
# gem "mry", "~> 0.52"
# end
6 changes: 5 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
binda (0.1.6.alpha.1)
binda (0.1.6.alpha.3)
aasm (>= 4.11, < 4.13)
ancestry (>= 2.1, < 3.1)
bourbon (= 4.3.4)
Expand Down Expand Up @@ -120,6 +120,9 @@ GEM
ffi (1.9.18)
friendly_id (5.2.3)
activerecord (>= 4.0.0)
generator_spec (0.9.4)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
gh (0.15.1)
addressable (~> 2.4.0)
backports
Expand Down Expand Up @@ -329,6 +332,7 @@ DEPENDENCIES
capybara (>= 2.14, < 3)
database_cleaner (>= 1.6, < 2)
factory_bot_rails (~> 4.8)
generator_spec (~> 0.9.4)
github-markup (>= 1.6, < 2)
listen (~> 3.1)
mry (~> 0.52)
Expand Down
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,30 +430,30 @@ You can retrieve field content from a instance of `Binda::Component`, `Binda::Bo

| Helper |||
|---|---|---|
| `has_text`| Returns `true/false` | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_text) |
| `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/FieldableAssociations:get_text) |
| `has_string`| Returns `true/false`. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_string) |
| `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/FieldableAssociations:get_string) |
|`has_image`| Returns `true/false`.| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_image) |
|`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/FieldableAssociations:get_image_url) |
|`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/FieldableAssociations:get_image_path) |
|`get_image_size`| Returns the image size in MB. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_image_size) |
|`get_image_dimension`| Returns a hash { width: xxx, height: xxx } with image dimension. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_image_dimension) |
|`get_image_mime_type`| Returns the mime type of the image. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_image_mime_type) |
|`has_video`| Returns `true/false`.| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_video) |
|`get_video_url`| Returns the url of the video. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_video_url) |
|`get_video_path`| Returns the path of the video. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_image_path) |
|`has_date`| Returns `true/false` | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_date) |
|`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/FieldableAssociations:get_date) |
|`has_repeaters`| Returns `true/false`| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_repeaters) |
|`get_repeaters`| Returns an array of repeaters. See next session for more details. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_repeaters) |
|`get_selection_choices`| Returns an hash with label and value of the selected choice. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_selection_choices) |
|`get_radio_choice`| Returns an hash with label and value of the selected choice. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_radio_choice) |
|`get_checkbox_choices`| Returns an array of label/value pairs of all the selected choices. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_checkbox_choices) |
|`has_related_components`| Check if has related components. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_related_components) |
|`get_related_components`| Retrieve related components. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_related_components) |
|`has_related_boards`| Check if has related boards. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_related_boards) |
|`get_related_boards`| Retrieve related boards. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_related_boards) |
| `has_text`| Returns `true/false` | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_text) |
| `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) |
| `has_string`| Returns `true/false`. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_string) |
| `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) |
|`has_image`| Returns `true/false`.| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_image) |
|`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) |
|`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) |
|`get_image_size`| Returns the image size in MB. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_image_size) |
|`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) |
|`get_image_mime_type`| Returns the mime type of the image. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_image_mime_type) |
|`has_video`| Returns `true/false`.| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_video) |
|`get_video_url`| Returns the url of the video. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_video_url) |
|`get_video_path`| Returns the path of the video. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_image_path) |
|`has_date`| Returns `true/false` | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_date) |
|`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:get_date) |
|`has_repeaters`| Returns `true/false`| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_repeaters) |
|`get_repeaters`| Returns an array of repeaters. See next session for more details. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_repeaters) |
|`get_selection_choices`| Returns an hash with label and value of the selected choice. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_selection_choices) |
|`get_radio_choice`| Returns an hash with label and value of the selected choice. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_radio_choice) |
|`get_checkbox_choices`| Returns an array of label/value pairs of all the selected choices. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:get_checkbox_choices) |
|`has_related_components`| Check if has related components. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_related_components) |
|`get_related_components`| Retrieve related components. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_related_components) |
|`has_related_boards`| Check if has related boards. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_related_boards) |
|`get_related_boards`| Retrieve related boards. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociationHelpers:has_related_boards) |

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').

Expand Down Expand Up @@ -953,7 +953,7 @@ More info can be found at the [semantic versioning documentation](https://semver

### Bug reporting
Please refer to this [guide](http://yourbugreportneedsmore.info).
If you need direct help you can join [Binda Slack Community](https://bindacms.slack.com).
If you need direct help you can join [Binda Slack Channel](https://bindacms.slack.com).


### License
Expand Down
4 changes: 4 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('lib/**/*.rb')
end

# https://www.viget.com/articles/rails-engine-testing-with-rspec-capybara-and-factorygirl/
# Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
# require 'rspec/core'

APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
load 'rails/tasks/engine.rake'

Expand Down
3 changes: 3 additions & 0 deletions app/assets/javascripts/binda/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
// Select2
//= require select2/select2.full.min

// Lodash
//= require lodash

// TweenLite
// GSAP/CSSPlugin.min
// GSAP/EasePack.min
Expand Down
10 changes: 5 additions & 5 deletions app/assets/javascripts/binda/components/field_setting_choices.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
* FORM ITEM CHOICE
*/

import { _FormItemEditor } from "./form_item_editor";
import { resizeCollapsableStacks } from "./form_item_collapsable";

class FieldSettingChoices {
constructor() {
this.target = ".field-setting-choices--choice";
}

isSet() {
isPresent() {
if ($(this.target).length > 0) {
return true;
} else {
Expand Down Expand Up @@ -39,7 +39,7 @@ class FieldSettingChoices {
.closest(".field-setting-choices--choice")
.remove();
// Update form item editor size
_FormItemEditor.resize();
resizeCollapsableStacks();
}
);
}
Expand All @@ -65,7 +65,7 @@ function addChoice(event) {
// Append the clone right after
choices.prepend(clone);
// Update form item editor size
_FormItemEditor.resize();
resizeCollapsableStacks();
}

function deleteChoice(event) {
Expand All @@ -81,7 +81,7 @@ function deleteChoice(event) {
}).done(function() {
choice.remove();
// Update form item editor size
_FormItemEditor.resize();
resizeCollapsableStacks();
}).fail(function(data){
alert(data.responseJSON.errors);
});
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/binda/components/fileupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class FileUpload {
this.target = ".fileupload";
}

isSet() {
isPresent() {
if ($(this.target).length > 0) {
return true;
} else {
Expand Down
113 changes: 0 additions & 113 deletions app/assets/javascripts/binda/components/form_item.js

This file was deleted.

Loading

0 comments on commit 3995d90

Please sign in to comment.