binda 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7cdf2fdd2f63fc54ab639dce6c7c29e45c7c65bf
4
- data.tar.gz: 73eef58c3714cb6e4c9650e41526ef536602335f
3
+ metadata.gz: 52614555a658b18ef7f5328235b412ac4af9fda4
4
+ data.tar.gz: a8f26c65b1fa0cf4bb7381105966d778b1d058ef
5
5
  SHA512:
6
- metadata.gz: 3028b32b74dd17caf6c09047ad1c471fdbceb89f3e94f53c45ee1b6060563c71ff07eb3605631c467f6014f5cde1295496450627194b66ad04ae7b962297b36b
7
- data.tar.gz: 51c1457dabf83268f75850c134962476c2e03bc345d9b9a5c056a056bf89e195391abc0dac834ca58ca6730302244bf7c0c8f39d34606685c9a1b40c42806c07
6
+ metadata.gz: 76995be7b669677cb3d9c03ff3c6e0c711c8aa523e6f3c50b632a5b505d15021998da8f4075eaf1918fdb915309c8a8afe5577fcd71e95cc90076fc703b4e261
7
+ data.tar.gz: 61011c78f26c1c5fd94dd6cded81968ab38ccd4af583777786f7de41198970c61ea1053db7bbf383d9d5dabf185f9022c56a49a66b036cd609bffd8b61a4c237
data/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
  A modular CMS for Ruby on Rails 5.1.
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/binda.svg)](https://badge.fury.io/rb/binda)
5
- [![Code Climate](https://codeclimate.com/github/lacolonia/binda/badges/gpa.svg)](https://codeclimate.com/github/lacolonia/binda)
6
- [![Test Coverage](https://api.codeclimate.com/v1/badges/5dc62774a6b8b63aa72b/test_coverage)](https://codeclimate.com/github/lacolonia/binda/test_coverage)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/8eef73404f871e431560/maintainability)](https://codeclimate.com/github/BindaCMS/binda/maintainability)
6
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/8eef73404f871e431560/test_coverage)](https://codeclimate.com/github/BindaCMS/binda/test_coverage)
7
7
  [![Inline docs](http://inch-ci.org/github/lacolonia/binda.svg?branch=master)](http://inch-ci.org/github/lacolonia/binda)
8
8
 
9
9
  > This documentation has been written for the [Official Documentation](http://www.rubydoc.info/gems/binda), not the Github README.
@@ -613,7 +613,8 @@ rails binda:remove_orphan_fields
613
613
 
614
614
  Here a list of useful plugins:
615
615
 
616
- - [Binda Multilanguage](https://github.com/lacolonia/binda_multilanguage)
616
+ - [Binda API](https://github.com/lacolonia/binda-api)
617
+ - [Binda Shopify](https://github.com/lacolonia/binda-shopify)
617
618
 
618
619
  ---
619
620
 
@@ -967,7 +968,7 @@ $ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-0.1.4-da
967
968
  $ chmod +x ./cc-test-reporter
968
969
  $ ./cc-test-reporter before-build
969
970
  $ rspec
970
- $ ./cc-test-reporter after-build -r a8789f8ca71f52cc879c1fa313d94547c9a0ddbd207977fe997f686a71e0c400
971
+ $ ./cc-test-reporter after-build -r 7bffb1da50f35979ea3ef4fc205aa03c6b3c10fa603d5b66f19f81ab06d2ab97
971
972
  ```
972
973
 
973
974
  `cc-test-reporter` is ignored by the repo, so it want be pushed.
@@ -1003,8 +1004,19 @@ If you need direct help you can join [Binda Slack Channel](https://bindacms.slac
1003
1004
  ### License
1004
1005
  The gem is available as open source under the terms of the [GNU General Public License v3.0](https://github.com/a-barbieri/binda/blob/master/LICENSE).
1005
1006
 
1007
+
1008
+ Binda is a headless CMS with an intuitive out-of-the-box interface.
1009
+
1010
+ Copyright (C) 2017 Alessandro Barbieri
1011
+
1012
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License.
1013
+
1014
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
1015
+
1016
+ Find the GNU General Public License here <http://www.gnu.org/licenses/>.
1017
+
1006
1018
  ### Credits
1007
- Binda is inspired by [Spina CMS](https://github.com/denkGroot/Spina).
1019
+ Binda is inspired by [Spina CMS](https://github.com/SpinaCMS/Spina).
1008
1020
 
1009
1021
  We give also credit to authors and contributors of the gems that Binda uses. Huge thank you to all of them.
1010
1022
 
@@ -20,5 +20,25 @@ module Binda
20
20
  slug.blank?
21
21
  end
22
22
 
23
+ def self.remove_orphans
24
+ Board
25
+ .includes(:structure)
26
+ .where(binda_structures: {id: nil})
27
+ .each do |b|
28
+ b.destroy!
29
+ puts "Binda::Board with id ##{b.id} successfully destroyed"
30
+ end
31
+ end
32
+
33
+ # Create field instances for the current component
34
+ def create_field_instances
35
+ instance_field_settings = FieldSetting
36
+ .includes(field_group: [ :structure ])
37
+ .where(binda_structures: { id: self.structure.id })
38
+ instance_field_settings.each do |field_setting|
39
+ field_setting.create_field_instance_for(self)
40
+ end
41
+ end
42
+
23
43
  end
24
44
  end
@@ -60,7 +60,17 @@ module Binda
60
60
  instance_field_settings.each do |field_setting|
61
61
  field_setting.create_field_instance_for(self)
62
62
  end
63
- end
63
+ end
64
+
65
+ def self.remove_orphans
66
+ Component
67
+ .includes(:structure)
68
+ .where(binda_structures: {id: nil})
69
+ .each do |c|
70
+ c.destroy!
71
+ puts "Binda::Component with id ##{c.id} successfully destroyed"
72
+ end
73
+ end
64
74
 
65
75
  private
66
76
 
@@ -1,7 +1,7 @@
1
1
  <% current = f.object.find_or_create_a_field_by( field_setting.id, 'radio' ) %>
2
2
  <%= f.simple_fields_for "radios_attributes[]", current do |ff| %>
3
3
  <% if ff.object.choices.any? %>
4
- <%= ff.input :choice_ids,
4
+ <%= ff.input :choice_ids,
5
5
  label: field_setting.name.capitalize,
6
6
  hint: prepare_description_for_selections_form_hint(field_setting),
7
7
  as: :radio_buttons,
@@ -47,8 +47,8 @@ class CreateBindaTables < ActiveRecord::Migration[5.0]
47
47
  t.index :slug, unique: true
48
48
  t.text :description
49
49
  t.integer :position
50
- t.boolean :required
51
- t.boolean :read_only
50
+ t.boolean :required, default: false
51
+ t.boolean :read_only, default: false
52
52
  t.text :default_text
53
53
  t.string :field_type
54
54
  t.belongs_to :field_group
@@ -1,3 +1,3 @@
1
1
  module Binda
2
- VERSION = '0.1.9'.freeze
2
+ VERSION = '0.1.10'.freeze
3
3
  end
@@ -1,10 +1,12 @@
1
1
  namespace :binda do
2
2
  desc "Create missing field instances for each component and board"
3
3
  task :create_missing_field_instances => :environment do
4
- Binda::Component.all.each do |component|
5
- puts "checking component ##{component.id}"
6
- component.create_field_instances
7
- puts "component ##{component.id} checked"
4
+ %w( Component Board ).each do |instance_class|
5
+ "Binda::#{instance_class}".constantize.all.each do |instance|
6
+ puts "Checking Binda::#{instance_class} with id = #{instance.id} ..."
7
+ instance.create_field_instances
8
+ puts "Check completed"
9
+ end
8
10
  end
9
11
  end
10
12
  end
@@ -0,0 +1,10 @@
1
+ namespace :binda do
2
+
3
+ desc "Remove fields which are pointing to non-existing field setting"
4
+ task :remove_orphan_boards => :environment do
5
+ Binda::Board.remove_orphans
6
+ puts
7
+ puts "All orphans have been removed successfully"
8
+ end
9
+
10
+ end
@@ -0,0 +1,10 @@
1
+ namespace :binda do
2
+
3
+ desc "Remove fields which are pointing to non-existing field setting"
4
+ task :remove_orphan_components => :environment do
5
+ Binda::Component.remove_orphans
6
+ puts
7
+ puts "All orphans have been removed successfully"
8
+ end
9
+
10
+ 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.9
4
+ version: 0.1.10
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-05-18 00:00:00.000000000 Z
11
+ date: 2018-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '5.0'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.2'
22
+ version: '5.3'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '5.0'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.2'
32
+ version: '5.3'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: jquery-rails
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -107,7 +107,7 @@ dependencies:
107
107
  version: '3.3'
108
108
  - - "<"
109
109
  - !ruby/object:Gem::Version
110
- version: '3.6'
110
+ version: '4.1'
111
111
  type: :runtime
112
112
  prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
@@ -117,7 +117,7 @@ dependencies:
117
117
  version: '3.3'
118
118
  - - "<"
119
119
  - !ruby/object:Gem::Version
120
- version: '3.6'
120
+ version: '4.1'
121
121
  - !ruby/object:Gem::Dependency
122
122
  name: tinymce-rails
123
123
  requirement: !ruby/object:Gem::Requirement
@@ -904,6 +904,8 @@ files:
904
904
  - lib/tasks/add_default_helpers_class_task.rake
905
905
  - lib/tasks/add_video_feature_task.rake
906
906
  - lib/tasks/create_missing_field_instances_task.rake
907
+ - lib/tasks/remove_orphan_boards.rake
908
+ - lib/tasks/remove_orphan_components.rake
907
909
  - lib/tasks/remove_orphan_fields_task.rake
908
910
  - lib/tasks/set_repeater_position_task.rake
909
911
  - lib/tasks/update_image_details_task.rake
@@ -1120,7 +1122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1120
1122
  version: '0'
1121
1123
  requirements: []
1122
1124
  rubyforge_project:
1123
- rubygems_version: 2.6.12
1125
+ rubygems_version: 2.5.1
1124
1126
  signing_key:
1125
1127
  specification_version: 4
1126
1128
  summary: Binda CMS